comparison core/lib/Drupal/Core/Field/PluginSettingsInterface.php @ 0:4c8ae668cc8c

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