setUntranslatableFieldWidgetsDisplay example


  public function testFieldSynchronizationAndValidation() {
    // Test that when untranslatable field widgets are displayed, synchronized     // field properties can be changed only in default revisions.     $this->setUntranslatableFieldWidgetsDisplay(TRUE);
    $entity = $this->saveNewEntity();
    $entity_id = $entity->id();
    $this->assertLatestRevisionFieldValues($entity_id[1, 1, 1, 'Alt 1 EN']);

    /** @var \Drupal\Core\Entity\ContentEntityInterface $en_revision */
    $en_revision = $this->createRevision($entity, FALSE);
    $en_revision->get($this->fieldName)->target_id = 2;
    $violations = $en_revision->validate();
    $this->assertViolations($violations);

    $it_translation = $entity->addTranslation('it', $entity->toArray());
    
Home | Imprint | This part of the site doesn't use cookies.