de4b1e1a0f6892d3359db47b334be5d3e2cfb41b
[yaffs-website] / web / core / lib / Drupal / Core / Config / Entity / ConfigEntityTypeInterface.php
1 <?php
2
3 namespace Drupal\Core\Config\Entity;
4
5 use Drupal\Core\Entity\EntityTypeInterface;
6
7 /**
8  * Provides an interface for a configuration entity type and its metadata.
9  */
10 interface ConfigEntityTypeInterface extends EntityTypeInterface {
11
12   /**
13    * Length limit of the configuration entity prefix.
14    *
15    * Configuration entity names are composed of two parts:
16    * - The config prefix, which is returned by getConfigPrefix() and is
17    *   composed of:
18    *   - The provider module name (limited to 50 characters by
19    *     DRUPAL_EXTENSION_NAME_MAX_LENGTH).
20    *   - The module-specific namespace identifier, which defaults to the
21    *     configuration entity type ID. Entity type IDs are limited to 32
22    *     characters by EntityTypeInterface::ID_MAX_LENGTH.
23    * - The configuration entity ID.
24    * So, a typical configuration entity filename will look something like:
25    * provider_module_name.namespace_identifier.config_entity_id.yml
26    *
27    * Most file systems limit a file name's length to 255 characters, so
28    * ConfigBase::MAX_NAME_LENGTH restricts the full configuration object name
29    * to 250 characters (leaving 5 for the file extension). Therefore, in
30    * order to leave sufficient characters to construct a configuration ID,
31    * the configuration entity prefix is limited to 83 characters: up to 50
32    * characters for the module name, 1 for the dot, and 32 for the namespace
33    * identifier. This also allows modules with shorter names to define longer
34    * namespace identifiers if desired.
35    *
36    * @see \Drupal\Core\Config\ConfigBase::MAX_NAME_LENGTH
37    * @see \Drupal\Core\Config\Entity\ConfigEntityTypeInterface::getConfigPrefix()
38    * @see DRUPAL_EXTENSION_NAME_MAX_LENGTH
39    * @see \Drupal\Core\Config\Entity\ConfigEntityStorage::MAX_ID_LENGTH
40    * @see \Drupal\Core\Entity\EntityTypeInterface::ID_MAX_LENGTH
41    */
42   const PREFIX_LENGTH = 83;
43
44   /**
45    * Gets the config prefix used by the configuration entity type.
46    *
47    * The config prefix is used to prefix configuration entity IDs when they are
48    * stored in the configuration system. The default config prefix is
49    * constructed from the name of the module that provides the entity type and
50    * the ID of the entity type. If a config_prefix annotation is present it will
51    * be used in place of the entity type ID.
52    *
53    * Prefixing with the module that provides the configuration entity type
54    * ensures that configuration entities depend on the module that provides the
55    * configuration entity type.
56    *
57    * @return string
58    *   The config prefix.
59    *
60    * @throws \Drupal\Core\Config\ConfigPrefixLengthException
61    *   Exception thrown when the length of the prefix exceeds PREFIX_LENGTH.
62    */
63   public function getConfigPrefix();
64
65   /**
66    * Gets the config entity properties to export if declared on the annotation.
67    *
68    * Falls back to determining the properties using configuration schema, if the
69    * config entity properties are not declared.
70    *
71    * @param string $id
72    *   The ID of the configuration entity. Used when checking schema instead of
73    *   the annotation.
74    *
75    * @return array|null
76    *   The properties to export or NULL if they can not be determine from the
77    *   config entity type annotation or the schema.
78    */
79   public function getPropertiesToExport($id = NULL);
80
81   /**
82    * Gets the keys that are available for fast lookup.
83    *
84    * @return string[]
85    *   The list of lookup keys.
86    */
87   public function getLookupKeys();
88
89 }