public function ViewListBuilder::getDefaultOperations in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views_ui/src/ViewListBuilder.php \Drupal\views_ui\ViewListBuilder::getDefaultOperations()
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 ConfigEntityListBuilder::getDefaultOperations
File
- core/
modules/ views_ui/ src/ ViewListBuilder.php, line 154 - Contains \Drupal\views_ui\ViewListBuilder.
Class
- ViewListBuilder
- Defines a class to build a listing of view entities.
Namespace
Drupal\views_uiCode
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if ($entity
->hasLinkTemplate('duplicate-form')) {
$operations['duplicate'] = array(
'title' => $this
->t('Duplicate'),
'weight' => 15,
'url' => $entity
->urlInfo('duplicate-form'),
);
}
// Add AJAX functionality to enable/disable operations.
foreach (array(
'enable',
'disable',
) as $op) {
if (isset($operations[$op])) {
$operations[$op]['url'] = $entity
->urlInfo($op);
// Enable and disable operations should use AJAX.
$operations[$op]['attributes']['class'][] = 'use-ajax';
}
}
return $operations;
}