public function ViewsCommands::disable

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

Disable the specified views.

@command views-disable @validate-entity-load view views

@usage drush vdis frontpage taxonomy_term Disable the frontpage and taxonomy_term views. @complete \Drush\CommandFiles\core\ViewsCommands::complete @bootstrap DRUSH_BOOTSTRAP_DRUPAL_FULL @aliases vdis

Parameters

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

File

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

Namespace

Drush\CommandFiles\core

Class

ViewsCommands

Code

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