ContributorStorage.php in Bibliography & Citation 2.0.x
File
modules/bibcite_entity/src/ContributorStorage.php
View source
<?php
namespace Drupal\bibcite_entity;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
class ContributorStorage extends SqlContentEntityStorage {
protected function initFieldValues(ContentEntityInterface $entity, array $values = [], array $field_names = []) {
$this
->initContributorName($entity, $values);
parent::initFieldValues($entity, $values, $field_names);
}
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;
}
}
}
}
}