Version 1
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Setting / SettingInterface.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Setting\SettingInterface.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Setting;
8
9 use Drupal\bootstrap\Plugin\Form\FormInterface;
10 use Drupal\bootstrap\Utility\Element;
11 use Drupal\Component\Plugin\PluginInspectionInterface;
12 use Drupal\Core\Form\FormStateInterface;
13
14 /**
15  * Defines the interface for an object oriented theme setting plugin.
16  *
17  * @ingroup plugins_setting
18  */
19 interface SettingInterface extends PluginInspectionInterface, FormInterface {
20
21   /**
22    * Determines whether a theme setting should added to drupalSettings.
23    *
24    * By default, this value will be FALSE unless the method is overridden. This
25    * is to ensure that no sensitive information can be potientially leaked.
26    *
27    * @see \Drupal\bootstrap\Plugin\Setting\SettingBase::drupalSettings()
28    *
29    * @return bool
30    *   TRUE or FALSE
31    */
32   public function drupalSettings();
33
34   /**
35    * The cache tags associated with this object.
36    *
37    * When this object is modified, these cache tags will be invalidated.
38    *
39    * @return string[]
40    *   A set of cache tags.
41    */
42   public function getCacheTags();
43
44   /**
45    * Retrieves the setting's default value.
46    *
47    * @return string
48    *   The setting's default value.
49    */
50   public function getDefaultValue();
51
52   /**
53    * Retrieves the group form element the setting belongs to.
54    *
55    * @param array $form
56    *   Nested array of form elements that comprise the form.
57    * @param \Drupal\Core\Form\FormStateInterface $form_state
58    *   The current state of the form.
59    *
60    * @return \Drupal\bootstrap\Utility\Element
61    *   The group element object.
62    *
63    * @deprecated Will be removed in a future release. Use \Drupal\bootstrap\Plugin\Setting\SettingInterface::getGroupElement
64    */
65   public function getGroup(array &$form, FormStateInterface $form_state);
66
67   /**
68    * Retrieves the group form element the setting belongs to.
69    *
70    * @param \Drupal\bootstrap\Utility\Element $form
71    *   The Element object that comprises the form.
72    * @param \Drupal\Core\Form\FormStateInterface $form_state
73    *   The current state of the form.
74    *
75    * @return \Drupal\bootstrap\Utility\Element
76    *   The group element object.
77    */
78   public function getGroupElement(Element $form, FormStateInterface $form_state);
79
80   /**
81    * Retrieves the setting's groups.
82    *
83    * @return array
84    *   The setting's group.
85    */
86   public function getGroups();
87
88   /**
89    * Retrieves the form element for the setting.
90    *
91    * @param array $form
92    *   Nested array of form elements that comprise the form.
93    * @param \Drupal\Core\Form\FormStateInterface $form_state
94    *   The current state of the form.
95    *
96    * @return \Drupal\bootstrap\Utility\Element
97    *   The setting element object.
98    *
99    * @deprecated Will be removed in a future release. Use \Drupal\bootstrap\Plugin\Setting\SettingInterface::getSettingElement
100    */
101   public function getElement(array &$form, FormStateInterface $form_state);
102
103   /**
104    * Retrieves the settings options, if set.
105    *
106    * @return array
107    *   An array of options.
108    */
109   public function getOptions();
110
111   /**
112    * Retrieves the form element for the setting.
113    *
114    * @param \Drupal\bootstrap\Utility\Element $form
115    *   The Element object that comprises the form.
116    * @param \Drupal\Core\Form\FormStateInterface $form_state
117    *   The current state of the form.
118    *
119    * @return \Drupal\bootstrap\Utility\Element
120    *   The setting element object.
121    */
122   public function getSettingElement(Element $form, FormStateInterface $form_state);
123
124   /**
125    * Retrieves the setting's human-readable title.
126    *
127    * @return string
128    *   The setting's type.
129    */
130   public function getTitle();
131
132 }