function SearchPage::postCreate

Same name in other branches
  1. 9 core/modules/search/src/Entity/SearchPage.php \Drupal\search\Entity\SearchPage::postCreate()
  2. 8.9.x core/modules/search/src/Entity/SearchPage.php \Drupal\search\Entity\SearchPage::postCreate()
  3. 10 core/modules/search/src/Entity/SearchPage.php \Drupal\search\Entity\SearchPage::postCreate()

Overrides EntityBase::postCreate

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.