Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\Field;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Component\Plugin\PluginInspectionInterface;
|
Chris@0
|
6 use Drupal\Core\Config\Entity\ThirdPartySettingsInterface;
|
Chris@0
|
7
|
Chris@0
|
8 /**
|
Chris@0
|
9 * Interface definition for plugin with settings.
|
Chris@0
|
10 *
|
Chris@0
|
11 * @deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. Use
|
Chris@18
|
12 * \Drupal\Component\Plugin\ConfigurableInterface instead.
|
Chris@0
|
13 */
|
Chris@0
|
14 interface PluginSettingsInterface extends PluginInspectionInterface, ThirdPartySettingsInterface {
|
Chris@0
|
15
|
Chris@0
|
16 /**
|
Chris@0
|
17 * Defines the default settings for this plugin.
|
Chris@0
|
18 *
|
Chris@0
|
19 * @return array
|
Chris@0
|
20 * A list of default settings, keyed by the setting name.
|
Chris@0
|
21 */
|
Chris@0
|
22 public static function defaultSettings();
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * Returns the array of settings, including defaults for missing settings.
|
Chris@0
|
26 *
|
Chris@0
|
27 * @return array
|
Chris@0
|
28 * The array of settings.
|
Chris@0
|
29 */
|
Chris@0
|
30 public function getSettings();
|
Chris@0
|
31
|
Chris@0
|
32 /**
|
Chris@0
|
33 * Returns the value of a setting, or its default value if absent.
|
Chris@0
|
34 *
|
Chris@0
|
35 * @param string $key
|
Chris@0
|
36 * The setting name.
|
Chris@0
|
37 *
|
Chris@0
|
38 * @return mixed
|
Chris@0
|
39 * The setting value.
|
Chris@0
|
40 */
|
Chris@0
|
41 public function getSetting($key);
|
Chris@0
|
42
|
Chris@0
|
43 /**
|
Chris@0
|
44 * Sets the settings for the plugin.
|
Chris@0
|
45 *
|
Chris@0
|
46 * @param array $settings
|
Chris@0
|
47 * The array of settings, keyed by setting names. Missing settings will be
|
Chris@0
|
48 * assigned their default values.
|
Chris@0
|
49 *
|
Chris@0
|
50 * @return $this
|
Chris@0
|
51 */
|
Chris@0
|
52 public function setSettings(array $settings);
|
Chris@0
|
53
|
Chris@0
|
54 /**
|
Chris@0
|
55 * Sets the value of a setting for the plugin.
|
Chris@0
|
56 *
|
Chris@0
|
57 * @param string $key
|
Chris@0
|
58 * The setting name.
|
Chris@0
|
59 * @param mixed $value
|
Chris@0
|
60 * The setting value.
|
Chris@0
|
61 *
|
Chris@0
|
62 * @return $this
|
Chris@0
|
63 */
|
Chris@0
|
64 public function setSetting($key, $value);
|
Chris@0
|
65
|
Chris@0
|
66 /**
|
Chris@0
|
67 * Informs the plugin that some configuration it depends on will be deleted.
|
Chris@0
|
68 *
|
Chris@0
|
69 * This method allows plugins to keep their configuration up-to-date when a
|
Chris@0
|
70 * dependency calculated with ::calculateDependencies() is removed. For
|
Chris@0
|
71 * example, an entity view display contains a formatter having a setting
|
Chris@0
|
72 * pointing to an arbitrary config entity. When that config entity is deleted,
|
Chris@0
|
73 * this method is called by the view display to react to the dependency
|
Chris@0
|
74 * removal by updating its configuration.
|
Chris@0
|
75 *
|
Chris@0
|
76 * This method must return TRUE if the removal event updated the plugin
|
Chris@0
|
77 * configuration or FALSE otherwise.
|
Chris@0
|
78 *
|
Chris@0
|
79 * @param array $dependencies
|
Chris@0
|
80 * An array of dependencies that will be deleted keyed by dependency type.
|
Chris@0
|
81 * Dependency types are 'config', 'content', 'module' and 'theme'.
|
Chris@0
|
82 *
|
Chris@0
|
83 * @return bool
|
Chris@0
|
84 * TRUE if the plugin configuration has changed, FALSE if not.
|
Chris@0
|
85 *
|
Chris@0
|
86 * @see \Drupal\Core\Entity\EntityDisplayBase
|
Chris@0
|
87 */
|
Chris@0
|
88 public function onDependencyRemoval(array $dependencies);
|
Chris@0
|
89
|
Chris@0
|
90 }
|