You are here

public function ViewsDuplicateBuilderBase::createView in Views Templates 8

Create a View. Don't save it.

Parameters

mixed $options: Options to create a view.

Return value

\Drupal\views\ViewEntityInterface Returns a view.

Overrides ViewsBuilderBase::createView

File

src/Plugin/ViewsDuplicateBuilderBase.php, line 55

Class

ViewsDuplicateBuilderBase
ViewsDuplicateBuilderBase Class.

Namespace

Drupal\views_templates\Plugin

Code

public function createView($options = NULL) {
  if ($view_template = $this
    ->loadTemplate($options)) {
    $view_template['id'] = $options['id'];
    $view_template['label'] = $options['label'];
    $view_template['description'] = $options['description'];
    return View::create($view_template);
  }
  return NULL;
}