1b666218b912c53d2baebc22babdb3826457c763
[yaffs-website] / web / core / modules / field / src / FieldStorageConfigInterface.php
1 <?php
2
3 namespace Drupal\field;
4
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
6 use Drupal\Core\Field\FieldStorageDefinitionInterface;
7
8 /**
9  * Provides an interface defining a field storage entity.
10  */
11 interface FieldStorageConfigInterface extends ConfigEntityInterface, FieldStorageDefinitionInterface {
12
13   /**
14    * Returns the field type.
15    *
16    * @return string
17    *   The field type, i.e. the id of a field type plugin. For example 'text'.
18    */
19   public function getType();
20
21   /**
22    * Returns the name of the module providing the field type.
23    *
24    * @return string
25    *   The name of the module that provides the field type.
26    */
27   public function getTypeProvider();
28
29   /**
30    * Returns the list of bundles where the field storage has fields.
31    *
32    * @return array
33    *   An array of bundle names.
34    */
35   public function getBundles();
36
37   /**
38    * Returns whether the field is deleted or not.
39    *
40    * @return bool
41    *   TRUE if the field is deleted.
42    */
43   public function isDeleted();
44
45   /**
46    * Checks if the field storage can be deleted.
47    *
48    * @return bool
49    *   TRUE if the field storage can be deleted.
50    */
51   public function isDeletable();
52
53   /**
54    * Returns whether the field storage is locked or not.
55    *
56    * @return bool
57    *   TRUE if the field storage is locked.
58    */
59   public function isLocked();
60
61   /**
62    * Sets the locked flag.
63    *
64    * @param bool $locked
65    *   Sets value of locked flag.
66    *
67    * @return $this
68    */
69   public function setLocked($locked);
70
71   /**
72    * Sets the maximum number of items allowed for the field.
73    *
74    * @param int $cardinality
75    *   The cardinality value.
76    *
77    * @return $this
78    */
79   public function setCardinality($cardinality);
80
81   /**
82    * Sets the value for a field setting by name.
83    *
84    * @param string $setting_name
85    *   The name of the setting.
86    * @param mixed $value
87    *   The value of the setting.
88    *
89    * @return $this
90    */
91   public function setSetting($setting_name, $value);
92
93   /**
94    * Sets field storage settings.
95    *
96    * Note that the method does not unset existing settings not specified in the
97    * incoming $settings array.
98    *
99    * For example:
100    * @code
101    *   // Given these are the default settings.
102    *   $storage_definition->getSettings() === [
103    *     'fruit' => 'apple',
104    *     'season' => 'summer',
105    *   ];
106    *   // Change only the 'fruit' setting.
107    *   $storage_definition->setSettings(['fruit' => 'banana']);
108    *   // The 'season' setting persists unchanged.
109    *   $storage_definition->getSettings() === [
110    *     'fruit' => 'banana',
111    *     'season' => 'summer',
112    *   ];
113    * @endcode
114    *
115    * For clarity, it is preferred to use setSetting() if not all available
116    * settings are supplied.
117    *
118    * @param array $settings
119    *   The array of storage settings.
120    *
121    * @return $this
122    */
123   public function setSettings(array $settings);
124
125   /**
126    * Sets whether the field is translatable.
127    *
128    * @param bool $translatable
129    *   Whether the field is translatable.
130    *
131    * @return $this
132    */
133   public function setTranslatable($translatable);
134
135   /**
136    * Returns the custom storage indexes for the field data storage.
137    *
138    * @return array
139    *   An array of custom indexes.
140    */
141   public function getIndexes();
142
143   /**
144    * Sets the custom storage indexes for the field data storage..
145    *
146    * @param array $indexes
147    *   The array of custom indexes.
148    *
149    * @return $this
150    */
151   public function setIndexes(array $indexes);
152
153 }