public function ViewsCommands::enable

master ViewsCommands.php public ViewsCommands::enable($views)

Enable the specified views.

@command views-enable

@validate-entity-load view views @usage drush ven frontpage,taxonomy_term Enable the frontpage and taxonomy_term views. @complete \Drush\CommandFiles\core\ViewsCommands::complete @bootstrap DRUSH_BOOTSTRAP_DRUPAL_FULL @aliases ven

Parameters

string $views A comma delimited list of view names.:

File

lib/Drush/CommandFiles/core/ViewsCommands.php, line 259

Namespace

Drush\CommandFiles\core

Class

ViewsCommands

Code

public function enable($views) {
  $view_names = _convert_csv_to_array($views);
  if ($views = \Drupal::entityTypeManager()->getStorage('view')->loadMultiple($view_names)) {
    foreach ($views as $view) {
      $view->enable();
      $view->save();
    }
  }
  $this->logger->log(LogLevel::OK, dt('!str enabled.', ['!str' implode(', ', $view_names)]));
}