You are here

public function FieldConfig::postCreate in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/src/Entity/FieldConfig.php \Drupal\field\Entity\FieldConfig::postCreate()

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 130

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();
  }
}