public function ViewListController::getOperations

Implements Drupal\Core\Entity\EntityListController::getOperations();

Overrides EntityListController::getOperations

File

drupal/core/modules/views/views_ui/lib/Drupal/views_ui/ViewListController.php, line 87
Definition of Drupal\views_ui\ViewListController.

Class

ViewListController
Provides a listing of Views.

Namespace

Drupal\views_ui

Code

public function getOperations(EntityInterface $view) {
  $uri = $view
    ->uri();
  $path = $uri['path'];
  $definition['edit'] = array(
    'title' => t('Edit'),
    'href' => "{$path}/edit",
    'weight' => -5,
  );
  if (!$view
    ->isEnabled()) {
    $definition['enable'] = array(
      'title' => t('Enable'),
      'ajax' => TRUE,
      'token' => TRUE,
      'href' => "{$path}/enable",
      'weight' => -10,
    );
  }
  else {
    $definition['disable'] = array(
      'title' => t('Disable'),
      'ajax' => TRUE,
      'token' => TRUE,
      'href' => "{$path}/disable",
      'weight' => 0,
    );
  }

  // This property doesn't exist yet.
  if (!empty($view->overridden)) {
    $definition['revert'] = array(
      'title' => t('Revert'),
      'href' => "{$path}/revert",
      'weight' => 5,
    );
  }
  else {
    $definition['delete'] = array(
      'title' => t('Delete'),
      'href' => "{$path}/delete",
      'weight' => 10,
    );
  }
  $definition['clone'] = array(
    'title' => t('Clone'),
    'href' => "{$path}/clone",
    'weight' => 15,
  );
  return $definition;
}