protected function ContributorStorage::initContributorName in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_entity/src/ContributorStorage.php \Drupal\bibcite_entity\ContributorStorage::initContributorName()
Init contributor properties by full name string.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: Contributor entity.
array $values: Array of values.
1 call to ContributorStorage::initContributorName()
- ContributorStorage::initFieldValues in modules/bibcite_entity/ src/ ContributorStorage.php 
- Initializes field values.
File
- modules/bibcite_entity/ src/ ContributorStorage.php, line 31 
Class
- ContributorStorage
- Contributor storage.
Namespace
Drupal\bibcite_entityCode
protected function initContributorName(ContentEntityInterface $entity, array &$values = []) {
  if (isset($values['name'])) {
    $entity
      ->set('name', $values['name']);
    foreach ($entity::getNameParts() as $property) {
      if (!empty($value = $entity->{$property}->value)) {
        $values[$property] = $value;
      }
    }
  }
}