Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Entity / EntityFieldManagerInterface.php
1 <?php
2
3 namespace Drupal\Core\Entity;
4
5 /**
6  * Provides an interface for an entity field manager.
7  */
8 interface EntityFieldManagerInterface {
9
10   /**
11    * Gets the base field definitions for a content entity type.
12    *
13    * Only fields that are not specific to a given bundle or set of bundles are
14    * returned. This excludes configurable fields, as they are always attached
15    * to a specific bundle.
16    *
17    * @param string $entity_type_id
18    *   The entity type ID. Only entity types that implement
19    *   \Drupal\Core\Entity\FieldableEntityInterface are supported.
20    *
21    * @return \Drupal\Core\Field\FieldDefinitionInterface[]
22    *   The array of base field definitions for the entity type, keyed by field
23    *   name.
24    *
25    * @throws \LogicException
26    *   Thrown if one of the entity keys is flagged as translatable.
27    */
28   public function getBaseFieldDefinitions($entity_type_id);
29
30   /**
31    * Gets the field definitions for a specific bundle.
32    *
33    * @param string $entity_type_id
34    *   The entity type ID. Only entity types that implement
35    *   \Drupal\Core\Entity\FieldableEntityInterface are supported.
36    * @param string $bundle
37    *   The bundle.
38    *
39    * @return \Drupal\Core\Field\FieldDefinitionInterface[]
40    *   The array of field definitions for the bundle, keyed by field name.
41    */
42   public function getFieldDefinitions($entity_type_id, $bundle);
43
44   /**
45    * Gets the field storage definitions for a content entity type.
46    *
47    * This returns all field storage definitions for base fields and bundle
48    * fields of an entity type. Note that field storage definitions of a base
49    * field equal the full base field definition (i.e. they implement
50    * FieldDefinitionInterface), while the storage definitions for bundle fields
51    * may implement FieldStorageDefinitionInterface only.
52    *
53    * @param string $entity_type_id
54    *   The entity type ID. Only content entities are supported.
55    *
56    * @return \Drupal\Core\Field\FieldStorageDefinitionInterface[]
57    *   The array of field storage definitions for the entity type, keyed by
58    *   field name.
59    *
60    * @see \Drupal\Core\Field\FieldStorageDefinitionInterface
61    */
62   public function getFieldStorageDefinitions($entity_type_id);
63
64   /**
65    * Gets a lightweight map of fields across bundles.
66    *
67    * @return array
68    *   An array keyed by entity type. Each value is an array which keys are
69    *   field names and value is an array with two entries:
70    *   - type: The field type.
71    *   - bundles: An associative array of the bundles in which the field
72    *     appears, where the keys and values are both the bundle's machine name.
73    */
74   public function getFieldMap();
75
76   /**
77    * Sets a lightweight map of fields across bundles.
78    *
79    * @param array[] $field_map
80    *   See the return value of self::getFieldMap().
81    *
82    * @return $this
83    */
84   public function setFieldMap(array $field_map);
85
86   /**
87    * Gets a lightweight map of fields across bundles filtered by field type.
88    *
89    * @param string $field_type
90    *   The field type to filter by.
91    *
92    * @return array
93    *   An array keyed by entity type. Each value is an array which keys are
94    *   field names and value is an array with two entries:
95    *   - type: The field type.
96    *   - bundles: An associative array of the bundles in which the field
97    *     appears, where the keys and values are both the bundle's machine name.
98    */
99   public function getFieldMapByFieldType($field_type);
100
101   /**
102    * Clears static and persistent field definition caches.
103    */
104   public function clearCachedFieldDefinitions();
105
106   /**
107    * Disable the use of caches.
108    *
109    * @param bool $use_caches
110    *   FALSE to not use any caches.
111    *
112    * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
113    *
114    * @todo Remove in https://www.drupal.org/node/2549143.
115    */
116   public function useCaches($use_caches = FALSE);
117
118   /**
119    * Gets the "extra fields" for a bundle.
120    *
121    * @param string $entity_type_id
122    *   The entity type ID.
123    * @param string $bundle
124    *   The bundle name.
125    *
126    * @return array
127    *   A nested array of 'pseudo-field' elements. Each list is nested within the
128    *   following keys: entity type, bundle name, context (either 'form' or
129    *   'display'). The keys are the name of the elements as appearing in the
130    *   renderable array (either the entity form or the displayed entity). The
131    *   value is an associative array:
132    *   - label: The human readable name of the element. Make sure you sanitize
133    *     this appropriately.
134    *   - description: A short description of the element contents.
135    *   - weight: The default weight of the element.
136    *   - visible: (optional) The default visibility of the element. Defaults to
137    *     TRUE.
138    *   - edit: (optional) String containing markup (normally a link) used as the
139    *     element's 'edit' operation in the administration interface. Only for
140    *     'form' context.
141    *   - delete: (optional) String containing markup (normally a link) used as the
142    *     element's 'delete' operation in the administration interface. Only for
143    *     'form' context.
144    */
145   public function getExtraFields($entity_type_id, $bundle);
146
147 }