file SettingInterface.php

Namespace

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

Interfaces

Name Description
SettingInterface Defines the interface for an object oriented theme setting plugin.