function SearchPageListBuilder::getDefaultOperations
Same name in other branches
- 8.9.x 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 319
Class
- SearchPageListBuilder
- Defines a class to build a listing of search page entities.
Namespace
Drupal\searchCode
public function getDefaultOperations(EntityInterface $entity) {
/** @var \Drupal\search\SearchPageInterface $entity */
$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.