public function FieldConfigBase::postCreate

public FieldConfigBase::postCreate(EntityStorageInterface $storage)

Acts on a created entity before hooks are invoked.

Used after the entity is created, but before saving the entity and before any of the presave hooks are invoked.

See the Entity CRUD topic for more information.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

Overrides Entity::postCreate

See also

\Drupal\Core\Entity\EntityInterface::create()

File

core/lib/Drupal/Core/Field/FieldConfigBase.php, line 262

Class

FieldConfigBase
Base class for configurable field definitions.

Namespace

Drupal\Core\Field

Code

public function postCreate(EntityStorageInterface $storage) {
  parent::postCreate($storage);
  // If it was not present in the $values passed to create(), (e.g. for
  // programmatic creation), populate the denormalized field_type property
  // from the field storage, so that it gets saved in the config record.
  if (empty($this->field_type)) {
    $this->field_type = $this->getFieldStorageDefinition()->getType();
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!FieldConfigBase.php/function/FieldConfigBase::postCreate/8.1.x