Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / lib / Drupal / Core / Entity / Display / EntityDisplayInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity\Display;
4
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
6 use Drupal\Core\Entity\EntityWithPluginCollectionInterface;
7
8 /**
9  * Provides a common interface for entity displays.
10  */
11 interface EntityDisplayInterface extends ConfigEntityInterface, EntityWithPluginCollectionInterface {
12
13   /**
14    * Creates a duplicate of the entity display object on a different view mode.
15    *
16    * The new object necessarily has the same $targetEntityType and $bundle
17    * properties than the original one.
18    *
19    * @param string $view_mode
20    *   The view mode for the new object.
21    *
22    * @return static
23    *   A duplicate of this object with the given view mode.
24    */
25   public function createCopy($view_mode);
26
27   /**
28    * Gets the display options for all components.
29    *
30    * @return array
31    *   The array of display options, keyed by component name.
32    */
33   public function getComponents();
34
35   /**
36    * Gets the display options set for a component.
37    *
38    * @param string $name
39    *   The name of the component.
40    *
41    * @return array|null
42    *   The display options for the component, or NULL if the component is not
43    *   displayed.
44    */
45   public function getComponent($name);
46
47   /**
48    * Sets the display options for a component.
49    *
50    * @param string $name
51    *   The name of the component.
52    * @param array $options
53    *   The display options.
54    *
55    * @return $this
56    */
57   public function setComponent($name, array $options = []);
58
59   /**
60    * Sets a component to be hidden.
61    *
62    * @param string $name
63    *   The name of the component.
64    *
65    * @return $this
66    */
67   public function removeComponent($name);
68
69   /**
70    * Gets the highest weight of the components in the display.
71    *
72    * @return int|null
73    *   The highest weight of the components in the display, or NULL if the
74    *   display is empty.
75    */
76   public function getHighestWeight();
77
78   /**
79    * Gets the renderer plugin for a field (e.g. widget, formatter).
80    *
81    * @param string $field_name
82    *   The field name.
83    *
84    * @return \Drupal\Core\Field\PluginSettingsInterface|null
85    *   A widget or formatter plugin or NULL if the field does not exist.
86    */
87   public function getRenderer($field_name);
88
89   /**
90    * Gets the entity type for which this display is used.
91    *
92    * @return string
93    *   The entity type id.
94    */
95   public function getTargetEntityTypeId();
96
97   /**
98    * Gets the view or form mode to be displayed.
99    *
100    * @return string
101    *   The mode to be displayed.
102    */
103   public function getMode();
104
105   /**
106    * Gets the original view or form mode that was requested.
107    *
108    * @return string
109    *   The original mode that was requested.
110    */
111   public function getOriginalMode();
112
113   /**
114    * Gets the bundle to be displayed.
115    *
116    * @return string
117    *   The bundle to be displayed.
118    */
119   public function getTargetBundle();
120
121   /**
122    * Sets the bundle to be displayed.
123    *
124    * @param string $bundle
125    *   The bundle to be displayed.
126    *
127    * @return $this
128    */
129   public function setTargetBundle($bundle);
130
131 }