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 * Checks if the field storage can be deleted.
|
Chris@0
|
39 *
|
Chris@0
|
40 * @return bool
|
Chris@0
|
41 * TRUE if the field storage can be deleted.
|
Chris@0
|
42 */
|
Chris@0
|
43 public function isDeletable();
|
Chris@0
|
44
|
Chris@0
|
45 /**
|
Chris@0
|
46 * Returns whether the field storage is locked or not.
|
Chris@0
|
47 *
|
Chris@0
|
48 * @return bool
|
Chris@0
|
49 * TRUE if the field storage is locked.
|
Chris@0
|
50 */
|
Chris@0
|
51 public function isLocked();
|
Chris@0
|
52
|
Chris@0
|
53 /**
|
Chris@0
|
54 * Sets the locked flag.
|
Chris@0
|
55 *
|
Chris@0
|
56 * @param bool $locked
|
Chris@0
|
57 * Sets value of locked flag.
|
Chris@0
|
58 *
|
Chris@0
|
59 * @return $this
|
Chris@0
|
60 */
|
Chris@0
|
61 public function setLocked($locked);
|
Chris@0
|
62
|
Chris@0
|
63 /**
|
Chris@0
|
64 * Sets the maximum number of items allowed for the field.
|
Chris@0
|
65 *
|
Chris@0
|
66 * @param int $cardinality
|
Chris@0
|
67 * The cardinality value.
|
Chris@0
|
68 *
|
Chris@0
|
69 * @return $this
|
Chris@0
|
70 */
|
Chris@0
|
71 public function setCardinality($cardinality);
|
Chris@0
|
72
|
Chris@0
|
73 /**
|
Chris@0
|
74 * Sets the value for a field setting by name.
|
Chris@0
|
75 *
|
Chris@0
|
76 * @param string $setting_name
|
Chris@0
|
77 * The name of the setting.
|
Chris@0
|
78 * @param mixed $value
|
Chris@0
|
79 * The value of the setting.
|
Chris@0
|
80 *
|
Chris@0
|
81 * @return $this
|
Chris@0
|
82 */
|
Chris@0
|
83 public function setSetting($setting_name, $value);
|
Chris@0
|
84
|
Chris@0
|
85 /**
|
Chris@0
|
86 * Sets field storage settings.
|
Chris@0
|
87 *
|
Chris@0
|
88 * Note that the method does not unset existing settings not specified in the
|
Chris@0
|
89 * incoming $settings array.
|
Chris@0
|
90 *
|
Chris@0
|
91 * For example:
|
Chris@0
|
92 * @code
|
Chris@0
|
93 * // Given these are the default settings.
|
Chris@0
|
94 * $storage_definition->getSettings() === [
|
Chris@0
|
95 * 'fruit' => 'apple',
|
Chris@0
|
96 * 'season' => 'summer',
|
Chris@0
|
97 * ];
|
Chris@0
|
98 * // Change only the 'fruit' setting.
|
Chris@0
|
99 * $storage_definition->setSettings(['fruit' => 'banana']);
|
Chris@0
|
100 * // The 'season' setting persists unchanged.
|
Chris@0
|
101 * $storage_definition->getSettings() === [
|
Chris@0
|
102 * 'fruit' => 'banana',
|
Chris@0
|
103 * 'season' => 'summer',
|
Chris@0
|
104 * ];
|
Chris@0
|
105 * @endcode
|
Chris@0
|
106 *
|
Chris@0
|
107 * For clarity, it is preferred to use setSetting() if not all available
|
Chris@0
|
108 * settings are supplied.
|
Chris@0
|
109 *
|
Chris@0
|
110 * @param array $settings
|
Chris@0
|
111 * The array of storage settings.
|
Chris@0
|
112 *
|
Chris@0
|
113 * @return $this
|
Chris@0
|
114 */
|
Chris@0
|
115 public function setSettings(array $settings);
|
Chris@0
|
116
|
Chris@0
|
117 /**
|
Chris@0
|
118 * Sets whether the field is translatable.
|
Chris@0
|
119 *
|
Chris@0
|
120 * @param bool $translatable
|
Chris@0
|
121 * Whether the field is translatable.
|
Chris@0
|
122 *
|
Chris@0
|
123 * @return $this
|
Chris@0
|
124 */
|
Chris@0
|
125 public function setTranslatable($translatable);
|
Chris@0
|
126
|
Chris@0
|
127 /**
|
Chris@0
|
128 * Returns the custom storage indexes for the field data storage.
|
Chris@0
|
129 *
|
Chris@0
|
130 * @return array
|
Chris@0
|
131 * An array of custom indexes.
|
Chris@0
|
132 */
|
Chris@0
|
133 public function getIndexes();
|
Chris@0
|
134
|
Chris@0
|
135 /**
|
Chris@0
|
136 * Sets the custom storage indexes for the field data storage..
|
Chris@0
|
137 *
|
Chris@0
|
138 * @param array $indexes
|
Chris@0
|
139 * The array of custom indexes.
|
Chris@0
|
140 *
|
Chris@0
|
141 * @return $this
|
Chris@0
|
142 */
|
Chris@0
|
143 public function setIndexes(array $indexes);
|
Chris@0
|
144
|
Chris@0
|
145 }
|