FieldConfig::postCreate

public FieldConfig::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 FieldConfigBase::postCreate

See also

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

File

core/modules/field/src/Entity/FieldConfig.php, line 121

Class

FieldConfig
Defines the Field entity.

Namespace

Drupal\field\Entity

Code

public function postCreate(EntityStorageInterface $storage) {
  parent::postCreate($storage);

  // Validate that we have a valid storage for this field. This throws an
  // exception if the storage is invalid.
  $this->getFieldStorageDefinition();

  // 'Label' defaults to the field name (mostly useful for fields created in
  // tests).
  if (empty($this->label)) {
    $this->label = $this->getName();
  }
}
doc_Drupal
2016-10-29 09:10:40
Comments
Leave a Comment

Please login to continue.