public function ImportEntityListBuilder::getOperations in Content Synchronizer 3.x
Same name and namespace in other branches
- 8.2 src/ImportEntityListBuilder.php \Drupal\content_synchronizer\ImportEntityListBuilder::getOperations()
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/
ImportEntityListBuilder.php, line 46
Class
- ImportEntityListBuilder
- Defines a class to build a listing of Import entities.
Namespace
Drupal\content_synchronizerCode
public function getOperations(EntityInterface $entity) {
$operations = parent::getOperations($entity);
$operations['view'] = [
'title' => $this
->t('Import'),
'weight' => 1,
'url' => new Url('entity.import_entity.canonical', [
'import_entity' => $entity
->id(),
]),
];
usort($operations, function ($a, $b) {
if ($a['weight'] > $b['weight']) {
return 1;
}
return -1;
});
return $operations;
}