public function MappingListBuilder::getDefaultOperations in GatherContent 8.5
Same name and namespace in other branches
- 8.4 gathercontent_ui/src/MappingListBuilder.php \Drupal\gathercontent_ui\MappingListBuilder::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
- gathercontent_ui/
src/ MappingListBuilder.php, line 193
Class
- MappingListBuilder
- Provides a listing of GatherContent Mapping entities.
Namespace
Drupal\gathercontent_uiCode
public function getDefaultOperations(EntityInterface $entity) {
$exists = isset($this->templates[$entity
->getGathercontentTemplateId()]);
$operations = [];
if ($exists && $entity
->access('update') && $entity
->hasLinkTemplate('edit-form')) {
$operations['edit'] = [
'title' => $entity
->hasMapping() ? $this
->t('Edit') : $this
->t('Create'),
'weight' => 10,
'url' => $entity
->toUrl('edit-form'),
];
}
if ($entity
->access('delete') && $entity
->hasLinkTemplate('delete-form')) {
$operations['delete'] = [
'title' => $this
->t('Delete'),
'weight' => 100,
'url' => $entity
->toUrl('delete-form'),
];
}
return $operations;
}