setBundleTranslationSettings example


    $this->drupalLogin($user);

    // Enable translation for article.     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'article');
    $config->setDefaultLangcode(LanguageInterface::LANGCODE_SITE_DEFAULT);
    $config->setLanguageAlterable(TRUE);
    $config->save();

    $content_translation_manager = $this->container->get('content_translation.manager');
    $content_translation_manager->setEnabled('node', 'article', TRUE);
    $content_translation_manager->setBundleTranslationSettings('node', 'article', [
      'untranslatable_fields_hide' => FALSE,
    ]);

    $this->rebuildContainer();

    $this->createImageField('field_image_field', 'article');
  }

  /** * Tests that the source language is properly set when changing. */
  


  /** * Sets untranslatable field widgets' display status. * * @param bool $display * Whether untranslatable field widgets should be displayed. */
  protected function setUntranslatableFieldWidgetsDisplay($display) {
    $entity_type_id = $this->storage->getEntityTypeId();
    $settings = ['untranslatable_fields_hide' => !$display];
    $this->contentTranslationManager->setBundleTranslationSettings($entity_type_id$entity_type_id$settings);
    /** @var \Drupal\Core\Entity\EntityTypeBundleInfo $bundle_info */
    $bundle_info = $this->container->get('entity_type.bundle.info');
    $bundle_info->clearCachedBundles();
  }

  /** * @return \Drupal\Core\Entity\ContentEntityInterface */
  protected function saveNewEntity() {
    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
    $entity = EntityTestMulRev::create([
      
Home | Imprint | This part of the site doesn't use cookies.