ViewEntityInterface.php 1.85 KB
Newer Older
damiankloip's avatar
damiankloip committed
1 2 3 4
<?php

namespace Drupal\views;

5
use Drupal\Core\Config\Entity\ConfigEntityInterface;
damiankloip's avatar
damiankloip committed
6 7 8 9

/**
 * Defines an interface for View storage classes.
 */
10
interface ViewEntityInterface extends ConfigEntityInterface {
11

12 13 14 15 16 17 18 19
  /**
   * Gets an executable instance for this view.
   *
   * @return \Drupal\views\ViewExecutable
   *   A view executable instance.
   */
  public function getExecutable();

20 21 22 23 24 25 26 27 28 29 30
  /**
   * Retrieves a specific display's configuration by reference.
   *
   * @param string $display_id
   *   The display ID to retrieve, e.g., 'default', 'page_1', 'block_2'.
   *
   * @return array
   *   A reference to the specified display configuration.
   */
  public function &getDisplay($display_id);

31 32 33 34
  /**
   * Add defaults to the display options.
   */
  public function mergeDefaultDisplaysOptions();
35

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
  /**
   * Duplicates an existing display into a new display type.
   *
   * For example clone to display a page display as a block display.
   *
   * @param string $old_display_id
   *   The origin of the duplicated display.
   * @param string $new_display_type
   *   The display type of the new display.
   *
   * @return string
   *   The display ID of the new display.
   */
  public function duplicateDisplayAsType($old_display_id, $new_display_type);

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
  /**
   * Adds a new display handler to the view, automatically creating an ID.
   *
   * @param string $plugin_id
   *   (optional) The plugin type from the Views plugin annotation. Defaults to
   *   'page'.
   * @param string $title
   *   (optional) The title of the display. Defaults to NULL.
   * @param string $id
   *   (optional) The ID to use, e.g., 'default', 'page_1', 'block_2'. Defaults
   *   to NULL.
   *
   * @return string|bool
   *   The key to the display in $view->display, or FALSE if no plugin ID was
   *   provided.
   */
  public function addDisplay($plugin_id = 'page', $title = NULL, $id = NULL);

damiankloip's avatar
damiankloip committed
69
}