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