function SearchPageListBuilder::getDefaultOperations
Same name in other branches
- 9 core/modules/search/src/SearchPageListBuilder.php \Drupal\search\SearchPageListBuilder::getDefaultOperations()
- 10 core/modules/search/src/SearchPageListBuilder.php \Drupal\search\SearchPageListBuilder::getDefaultOperations()
- 11.x core/modules/search/src/SearchPageListBuilder.php \Drupal\search\SearchPageListBuilder::getDefaultOperations()
Overrides ConfigEntityListBuilder::getDefaultOperations
File
-
core/
modules/ search/ src/ SearchPageListBuilder.php, line 323
Class
- SearchPageListBuilder
- Defines a class to build a listing of search page entities.
Namespace
Drupal\searchCode
public function getDefaultOperations(EntityInterface $entity) {
/** @var $entity \Drupal\search\SearchPageInterface */
$operations = parent::getDefaultOperations($entity);
// Prevent the default search from being disabled or deleted.
if ($entity->isDefaultSearch()) {
unset($operations['disable'], $operations['delete']);
}
else {
$operations['default'] = [
'title' => $this->t('Set as default'),
'url' => Url::fromRoute('entity.search_page.set_default', [
'search_page' => $entity->id(),
]),
'weight' => 50,
];
}
return $operations;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.