コード例 #1
0
ファイル: CommentSelection.php プロジェクト: aWEBoLabs/taxi
 /**
  * {@inheritdoc}
  */
 public function createNewEntity($entity_type_id, $bundle, $label, $uid)
 {
     $comment = parent::createNewEntity($entity_type_id, $bundle, $label, $uid);
     // In order to create a referenceable comment, it needs to published.
     /** @var \Drupal\comment\CommentInterface $comment */
     $comment->setPublished(TRUE);
     return $comment;
 }
コード例 #2
0
ファイル: NodeSelection.php プロジェクト: aWEBoLabs/taxi
 /**
  * {@inheritdoc}
  */
 public function createNewEntity($entity_type_id, $bundle, $label, $uid)
 {
     $node = parent::createNewEntity($entity_type_id, $bundle, $label, $uid);
     // In order to create a referenceable node, it needs to published.
     /** @var \Drupal\node\NodeInterface $node */
     $node->setPublished(TRUE);
     return $node;
 }
コード例 #3
0
ファイル: FileSelection.php プロジェクト: aWEBoLabs/taxi
 /**
  * {@inheritdoc}
  */
 public function createNewEntity($entity_type_id, $bundle, $label, $uid)
 {
     $file = parent::createNewEntity($entity_type_id, $bundle, $label, $uid);
     // In order to create a referenceable file, it needs to have a "permanent"
     // status.
     /** @var \Drupal\file\FileInterface $file */
     $file->setPermanent();
     return $file;
 }
コード例 #4
0
ファイル: UserSelection.php プロジェクト: eigentor/tommiblog
 /**
  * {@inheritdoc}
  */
 public function createNewEntity($entity_type_id, $bundle, $label, $uid)
 {
     $user = parent::createNewEntity($entity_type_id, $bundle, $label, $uid);
     // In order to create a referenceable user, it needs to be active.
     if (!$this->currentUser->hasPermission('administer users')) {
         /** @var \Drupal\user\UserInterface $user */
         $user->activate();
     }
     return $user;
 }