toggleFieldTranslatability example

$langcode = $this->langcodes[1];
    $entity->langcode->value = $langcode;
    $entity->save();
    $this->assertFieldStorageLangcode($entity, 'Field language successfully changed.');
    $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
    $entity->langcode->value = $langcode;
    $entity->save();
    $this->assertFieldStorageLangcode($entity, 'Field language successfully changed to language neutral.');

    // Test that after switching field translatability things keep working as     // before.     $this->toggleFieldTranslatability($entity_type$entity_type);
    $entity = $this->reloadEntity($entity);
    foreach ([$this->fieldName, $this->untranslatableFieldName] as $field_name) {
      $this->assertEquals($values[$field_name]$entity->get($field_name)->value, 'Field language works as expected after switching translatability.');
    }

    // Test that after disabling field translatability translated values are not     // loaded.     $this->toggleFieldTranslatability($entity_type$entity_type);
    $entity = $this->reloadEntity($entity);
    $entity->langcode->value = $this->langcodes[0];
    $translation = $entity->addTranslation($this->langcodes[1]);
    
Home | Imprint | This part of the site doesn't use cookies.