public function AutobanListBuilder::getOperations in Automatic IP ban (Autoban) 8
Operations list in the entity listing.
Parameters
Drupal\Core\Entity\EntityInterface $entity: The entity for which to build the row.
Return value
array A render array of the operations.
Overrides EntityListBuilder::getOperations
File
- src/
Controller/ AutobanListBuilder.php, line 148
Class
- AutobanListBuilder
- Provides a listing of autoban entities.
Namespace
Drupal\autoban\ControllerCode
public function getOperations(EntityInterface $entity) {
$operations = $this
->getDefaultOperations($entity);
$rule = $entity
->id();
$destination = $this
->getDestinationArray();
$operations['test'] = [
'title' => $this
->t('Test'),
'url' => Url::fromRoute('autoban.test', [
'rule' => $rule,
], [
'query' => $destination,
]),
'weight' => 20,
];
$operations['ban'] = [
'title' => $this
->t('Ban'),
'url' => Url::fromRoute('autoban.ban', [
'rule' => $rule,
], [
'query' => $destination,
]),
'weight' => 30,
];
$operations['clone'] = [
'title' => $this
->t('Clone'),
'url' => Url::fromRoute('entity.autoban.add_form', [
'rule' => $rule,
], [
'query' => $destination,
]),
'weight' => 40,
];
uasort($operations, '\\Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
return $operations;
}