You are here

public function SearchPage::postCreate in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/search/src/Entity/SearchPage.php \Drupal\search\Entity\SearchPage::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 EntityBase::postCreate

See also

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

File

core/modules/search/src/Entity/SearchPage.php, line 180

Class

SearchPage
Defines a configured search page.

Namespace

Drupal\search\Entity

Code

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

  // @todo Use self::applyDefaultValue() once
  //   https://www.drupal.org/node/2004756 is in.
  if (!isset($this->weight)) {
    $this->weight = $this
      ->isDefaultSearch() ? -10 : 0;
  }
}