public function SearchPageListBuilder::getDefaultOperations in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 301 - Contains \Drupal\search\SearchPageListBuilder.
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'] = array(
'title' => $this
->t('Set as default'),
'url' => Url::fromRoute('entity.search_page.set_default', [
'search_page' => $entity
->id(),
]),
'weight' => 50,
);
}
return $operations;
}