SearchPage::postCreate

public SearchPage::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/modules/search/src/Entity/SearchPage.php, line 174

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;
  }
}
doc_Drupal
2016-10-29 09:40:21
Comments
Leave a Comment

Please login to continue.