public function TourBuilderListBuilder::getOperations in Tour Builder 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 TourListBuilder::getOperations
File
- src/
TourBuilderListBuilder.php, line 32
Class
- TourBuilderListBuilder
- Provides a listing of tours.
Namespace
Drupal\tour_builderCode
public function getOperations(EntityInterface $entity) {
$operations = parent::getOperations($entity);
$tour = $entity
->getOriginalId();
$operations['clone'] = [
'title' => $this
->t('Clone'),
'url' => $entity
->toUrl('clone-form'),
'weight' => 11,
];
$operations['export'] = [
'title' => $this
->t('Export'),
'url' => $entity
->toUrl('export-form'),
'weight' => 12,
];
$user = \Drupal::currentUser();
if ($user
->hasPermission('export configuration')) {
$operations['export-config'] = [
'title' => $this
->t('Export (configuration)'),
'url' => Url::fromRoute('config.export_single', [
'config_type' => 'tour',
'config_name' => $tour,
]),
'weight' => 13,
];
}
// TODO: fix me
// $operations['patch'] = [
// 'title' => t('Patch'),
// 'url' => $entity->toUrl('edit-form'),
// 'weight' => 11,
// ]; // .
return $operations;
}