public function ProfileTypeListBuilder::getOperations in Profile 2 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/
ProfileTypeListBuilder.php, line 41 - Contains \Drupal\profile\ProfileTypeListController.
Class
- ProfileTypeListBuilder
- List controller for profile types.
Namespace
Drupal\profileCode
public function getOperations(EntityInterface $entity) {
$operations = parent::getOperations($entity);
// Place the edit operation after the operations added by field_ui.module
// which have the weights 15, 20, 25.
if (isset($operations['edit'])) {
$operations['edit'] = array(
'title' => t('Edit'),
'weight' => 30,
'url' => $entity
->urlInfo('edit-form'),
);
}
if (isset($operations['delete'])) {
$operations['delete'] = array(
'title' => t('Delete'),
'weight' => 35,
'url' => $entity
->urlInfo('delete-form'),
);
}
// Sort the operations to normalize link order.
uasort($operations, array(
'Drupal\\Component\\Utility\\SortArray',
'sortByWeightElement',
));
return $operations;
}