public function SearchPageListBuilder::getDefaultOperations in Drupal 10
Same name and namespace in other branches
- 8 core/modules/search/src/SearchPageListBuilder.php \Drupal\search\SearchPageListBuilder::getDefaultOperations()
- 9 core/modules/search/src/SearchPageListBuilder.php \Drupal\search\SearchPageListBuilder::getDefaultOperations()
Gets this list's default operations.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.
Return value
array The array structure is identical to the return value of self::getOperations().
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;
}