protected function FontListBuilder::getDefaultOperations in @font-your-face 8.3
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 EntityListBuilder::getDefaultOperations
File
- src/
FontListBuilder.php, line 49
Class
- FontListBuilder
- Defines a class to build a listing of Font entities.
Namespace
Drupal\fontyourfaceCode
protected function getDefaultOperations(EntityInterface $entity) {
$operations = [];
if ($entity
->access('update') && $entity
->hasLinkTemplate('edit-form')) {
$operations['edit'] = [
'title' => $this
->t('Edit'),
'weight' => 10,
'url' => $entity
->toUrl('edit-form'),
];
}
if ($entity
->isActivated()) {
$operations['disable'] = [
'title' => $this
->t('Disable'),
'weight' => 100,
'url' => Url::fromRoute('entity.font.deactivate', [
'js' => 'nojs',
'font' => $entity
->id(),
], [
'query' => \Drupal::destination()
->getAsArray(),
]),
];
}
if ($entity
->isDeactivated()) {
$operations['enable'] = [
'title' => $this
->t('enable'),
'weight' => 100,
'url' => Url::fromRoute('entity.font.activate', [
'js' => 'nojs',
'font' => $entity
->id(),
], [
'query' => \Drupal::destination()
->getAsArray(),
]),
];
}
return $operations;
}