public ViewListBuilder::getDefaultOperations(EntityInterface $entity)
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
Class
- ViewListBuilder
- Defines a class to build a listing of view entities.
Namespace
Drupal\views_ui
Code
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;
}
Please login to continue.