public function MetatagDefaultsListBuilder::getOperations in Metatag 8
Provides an array of information to build a list of operation links.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.
Return value
array An associative array of operation link data for this list, keyed by operation name, containing the following key-value pairs:
- title: The localized title of the operation.
- url: An instance of \Drupal\Core\Url for the operation URL.
- weight: The weight of this operation.
Overrides EntityListBuilder::getOperations
File
- src/
MetatagDefaultsListBuilder.php, line 78
Class
- MetatagDefaultsListBuilder
- Provides a listing of Metatag defaults entities.
Namespace
Drupal\metatagCode
public function getOperations(EntityInterface $entity) {
$operations = parent::getOperations($entity);
// Global and entity defaults can be reverted but not deleted.
if (in_array($entity
->id(), MetatagManager::protectedDefaults())) {
unset($operations['delete']);
$operations['revert'] = [
'title' => $this
->t('Revert'),
'weight' => $operations['edit']['weight'] + 1,
'url' => $entity
->toUrl('revert-form'),
];
}
return $operations;
}