getEntityOwnerPermissions example

'name' => 'referencing',
      'field_reference' => $this->entity->id(),
    ]);
    $this->referencingEntity->addTranslation($this->langcodes[2]$this->referencingEntity->toArray());
    $this->referencingEntity->save();
  }

  /** * {@inheritdoc} */
  protected function setupUsers() {
    $this->entityOwner = $this->drupalCreateUser($this->getEntityOwnerPermissions(), 'entity_owner');
    $this->notEntityOwner = $this->drupalCreateUser();
    $this->notEntityOwner->set('roles', $this->entityOwner->getRoles(TRUE));
    $this->notEntityOwner->save();
    parent::setupUsers();
  }

  /** * Returns an array of permissions needed for the entity owner. */
  protected function getEntityOwnerPermissions() {
    return ['edit own entity_test content', 'translate editable entities', 'view test entity', 'view test entity translations', 'view unpublished test entity translations'];
  }
Home | Imprint | This part of the site doesn't use cookies.