1<?php
2
3namespace Drupal\views;
4
5use Drupal\Core\Config\Entity\ConfigEntityInterface;
6
7/**
8 * Defines an interface for View storage classes.
9 */
10interface ViewEntityInterface extends ConfigEntityInterface {
11
12  /**
13   * Gets an executable instance for this view.
14   *
15   * @return \Drupal\views\ViewExecutable
16   *   A view executable instance.
17   */
18  public function getExecutable();
19
20  /**
21   * Retrieves a specific display's configuration by reference.
22   *
23   * @param string $display_id
24   *   The display ID to retrieve, e.g., 'default', 'page_1', 'block_2'.
25   *
26   * @return array
27   *   A reference to the specified display configuration.
28   */
29  public function &getDisplay($display_id);
30
31  /**
32   * Add defaults to the display options.
33   */
34  public function mergeDefaultDisplaysOptions();
35
36  /**
37   * Duplicates an existing display into a new display type.
38   *
39   * For example clone to display a page display as a block display.
40   *
41   * @param string $old_display_id
42   *   The origin of the duplicated display.
43   * @param string $new_display_type
44   *   The display type of the new display.
45   *
46   * @return string
47   *   The display ID of the new display.
48   */
49  public function duplicateDisplayAsType($old_display_id, $new_display_type);
50
51  /**
52   * Adds a new display handler to the view, automatically creating an ID.
53   *
54   * @param string $plugin_id
55   *   (optional) The plugin type from the Views plugin annotation. Defaults to
56   *   'page'.
57   * @param string $title
58   *   (optional) The title of the display. Defaults to NULL.
59   * @param string $id
60   *   (optional) The ID to use, e.g., 'default', 'page_1', 'block_2'. Defaults
61   *   to NULL.
62   *
63   * @return string|bool
64   *   The key to the display in $view->display, or FALSE if no plugin ID was
65   *   provided.
66   */
67  public function addDisplay($plugin_id = 'page', $title = NULL, $id = NULL);
68
69}
70