You are here

public function ContributorSelection::createNewEntity in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 modules/bibcite_entity/src/Plugin/EntityReferenceSelection/ContributorSelection.php \Drupal\bibcite_entity\Plugin\EntityReferenceSelection\ContributorSelection::createNewEntity()

Creates a new entity object that can be used as a valid reference.

Parameters

string $entity_type_id: The entity type ID.

string $bundle: The bundle name.

string $label: The entity label.

int $uid: The entity owner ID, if the entity type supports it.

Return value

\Drupal\Core\Entity\EntityInterface An unsaved entity object.

Overrides DefaultSelection::createNewEntity

File

modules/bibcite_entity/src/Plugin/EntityReferenceSelection/ContributorSelection.php, line 24

Class

ContributorSelection
Provides specific access control for the contributor entity type.

Namespace

Drupal\bibcite_entity\Plugin\EntityReferenceSelection

Code

public function createNewEntity($entity_type_id, $bundle, $label, $uid) {
  $entity = parent::createNewEntity($entity_type_id, $bundle, $label, $uid);
  $entity->name = $label;
  return $entity;
}