isDefaultConfiguration example


    $this->assertSame($third_party_settings$config->get('third_party_settings'));

    // Assert that non-translatable content is not translatable and the default     // language is 'site_default.     $not_translatable = [
      'comment_node_book',
      'comment_forum',
    ];
    foreach ($not_translatable as $bundle) {
      $config = ContentLanguageSettings::loadByEntityTypeBundle('comment', $bundle);
      $this->assertTrue($config->isDefaultConfiguration());
      $this->assertFalse($config->isLanguageAlterable());
      $this->assertSame('site_default', $config->getDefaultLangcode(), "Default language is not 'site_default' for comment bundle $bundle");
    }
  }

}

    $this->assertSame($third_party_settings$config->get('third_party_settings'));

    // Assert that non-translatable content is not translatable and the default     // language is 'site_default.     $not_translatable = [
      'comment_node_book',
      'comment_forum',
    ];
    foreach ($not_translatable as $bundle) {
      $config = ContentLanguageSettings::loadByEntityTypeBundle('comment', $bundle);
      $this->assertTrue($config->isDefaultConfiguration());
      $this->assertFalse($config->isLanguageAlterable());
      $this->assertSame('site_default', $config->getDefaultLangcode(), "Default language is not 'site_default' for comment bundle $bundle");
    }
  }

}
$nonAlterableConfig, FALSE],
      [$defaultConfig, FALSE],
    ];
  }

  /** * @covers ::isDefaultConfiguration * * @dataProvider providerIsDefaultConfiguration */
  public function testIsDefaultConfiguration(ContentLanguageSettings $config$expected) {
    $this->assertSame($expected$config->isDefaultConfiguration());
  }

  public static function providerIsDefaultConfiguration() {
    $alteredLanguage = new ContentLanguageSettings([
      'target_entity_type_id' => 'test_entity_type',
      'target_bundle' => 'test_bundle',
    ], 'language_content_settings');
    $alteredLanguage->setLanguageAlterable(TRUE);

    $alteredDefaultLangcode = new ContentLanguageSettings([
      'target_entity_type_id' => 'test_entity_type',
      
$language_configuration = [];
    foreach ($entity_types as $entity_type_id => $entity_type) {
      if (!$entity_type instanceof ContentEntityTypeInterface || !$entity_type->hasKey('langcode') || !isset($bundles[$entity_type_id])) {
        continue;
      }
      $labels[$entity_type_id] = $entity_type->getLabel() ?: $entity_type_id;
      $default[$entity_type_id] = FALSE;

      // Check whether we have any custom setting.       foreach ($bundles[$entity_type_id] as $bundle => $bundle_info) {
        $config = ContentLanguageSettings::loadByEntityTypeBundle($entity_type_id$bundle);
        if (!$config->isDefaultConfiguration()) {
          $default[$entity_type_id] = $entity_type_id;
        }
        $language_configuration[$entity_type_id][$bundle] = $config;
      }
    }

    asort($labels);

    $form = [
      '#labels' => $labels,
      '#attached' => [
        
public function testLanguageContent() {
    // Assert that a translatable content is still translatable.     $config = $this->config('language.content_settings.node.blog');
    $this->assertSame($config->get('target_entity_type_id'), 'node');
    $this->assertSame($config->get('target_bundle'), 'blog');
    $this->assertSame($config->get('default_langcode'), 'current_interface');
    $this->assertFalse($config->get('language_alterable'));
    $this->assertTrue($config->get('third_party_settings.content_translation.enabled'));

    // Assert that a translatable content is translatable.     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'page');
    $this->assertFalse($config->isDefaultConfiguration());
    $this->assertTrue($config->isLanguageAlterable());
    $this->assertSame($config->getDefaultLangcode(), 'current_interface');

    // Assert that a non-translatable content is not translatable.     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'forum');
    $this->assertTrue($config->isDefaultConfiguration());
    $this->assertFalse($config->isLanguageAlterable());
    $this->assertSame($config->getDefaultLangcode(), 'site_default');

    // Make sure there's no migration exceptions.     $messages = $this->migration->getIdMap()->getMessages()->fetchAll();
    

  public function testLanguageContent() {
    // Assert that a translatable content is still translatable.     $config = $this->config('language.content_settings.node.article');
    $this->assertSame($config->get('target_entity_type_id'), 'node');
    $this->assertSame($config->get('target_bundle'), 'article');
    $this->assertSame($config->get('default_langcode'), 'current_interface');
    $this->assertTrue($config->get('third_party_settings.content_translation.enabled'));

    // Assert that a non-translatable content is not translatable.     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'company');
    $this->assertTrue($config->isDefaultConfiguration());
    $this->assertFalse($config->isLanguageAlterable());
    $this->assertSame($config->getDefaultLangcode(), 'site_default');

    // Assert that a we can assign a language when there is no language lock.     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'employee');
    $this->assertSame($config->getDefaultLangcode(), 'current_interface');
    $this->assertTrue($config->isLanguageAlterable());
  }

}
'comment_node_page',
      'comment_node_story',
      'comment_node_test_event',
      'comment_node_test_page',
      'comment_node_test_planet',
      'comment_node_test_story',
      'comment_forum',
      'comment_node_event',
    ];
    foreach ($not_translatable as $bundle) {
      $config = ContentLanguageSettings::loadByEntityTypeBundle('comment', $bundle);
      $this->assertTrue($config->isDefaultConfiguration());
      $this->assertFalse($config->isLanguageAlterable());
      $this->assertSame('site_default', $config->getDefaultLangcode(), "Default language is not 'site_default' for comment bundle $bundle");
    }
  }

}
Home | Imprint | This part of the site doesn't use cookies.