diff --git a/core/includes/config.inc b/core/includes/config.inc index 4d04b9a..733ddfc 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -1,5 +1,10 @@ create() @@ -202,6 +202,7 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf * 403: '' * 404: '' * front: user + * admin_compact_mode: '0' * @endcode * * The metadata in core/modules/system/meta/system.site.yml: @@ -225,12 +226,11 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf * @endcode * * Elements that don't have an explicit type will default to the type 'string' - * unless they have children elements (like 'page' in the example) or the - * 'list' property set to true, in which case they will default to the type - * 'config_element'. + * unless they have child elements (like 'page' in the example) or the 'list' + * property, in which case they will default to the type 'config_element'. * * Nested lists of elements, that contain additional metadata for each of the - * elements in a different file are also supported. + * elements in a different file, are also supported. * * Here are parts of core/modules/user/config/user.mail.yml: * @code @@ -253,7 +253,6 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf * body: * .label: 'Body' * .type: 'text' - * @endcode * * For every element in the list of user mails, the metadata is specified by @@ -303,13 +302,17 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf * effects: * .label: 'Style effects' * .list: - * .include: 'image.effect.[name]' - * .label: 'Image style effect' - * weight: - * .label: 'Weight' - * .type: integer - * ieid: - * .label: 'IEID' + * .label: 'Image effect' + * weight: + * .label: 'Weight' + * .type: integer + * ieid: + * .label: 'IEID' + * name: + * .label: 'Machine name' + * data: + * .include: 'image.effect.[%parent.name]' + * .label: 'Data' * @endcode * * For this example, for each image effect, we have the metadata under the @@ -330,22 +333,16 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf * * For example here is meta/image.effect.image_scale.yml: * @code - * .label: 'Image scale' - * data: - * width: - * .label: 'Width' - * .type: 'integer' - * height: - * .label: 'Height' - * .type: 'integer' - * upscale: - * .label: 'Upscale' - * .type: 'boolean' - * @endcode - * - * @see \Drupal\Core\TypedData\TypedDataManager::create() - * @see \Drupal\Core\Config\Metadata\ElementBase - * @see \Drupal\Core\Config\Metadata\ListElement + * width: + * .label: 'Width' + * .type: integer + * height: + * .label: 'Height' + * .type: integer + * upscale: + * .label: 'Upscale' + * .type: boolean + * @endcode * * @param string $name * The name or key of the configuration object, the same as passed to @@ -354,6 +351,9 @@ function config_sync_get_changes(StorageInterface $source_storage, StorageInterf * @return \Drupal\Core\Config\Metadata\MetadataLookup * A metadata array. * + * @see \Drupal\Core\TypedData\TypedDataManager::create() + * @see \Drupal\Core\Config\Metadata\ElementBase + * @see \Drupal\Core\Config\Metadata\ListElement * @see \Drupal\Core\Config\Metadata\ElementInterface::getMetadata() */ function config_metadata($name) { diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index f07c798..6fc2a87 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -323,7 +323,7 @@ public function clear($key) { /** * Loads configuration data into this object. * - * @return \Drupal\Core\Config\Config + * @return Drupal\Core\Config\Config * The configuration object. */ public function load() { diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index c959673..ca36ce7 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -58,7 +58,7 @@ public function __construct(StorageInterface $storage, EventDispatcher $event_di * @param string $name * The name of the configuration object to construct. * - * @return \Drupal\Core\Config\Config + * @return Drupal\Core\Config\Config * A configuration object with the given $name. */ public function get($name) { diff --git a/core/lib/Drupal/Core/Config/InstallStorage.php b/core/lib/Drupal/Core/Config/InstallStorage.php index f4344de..994c90d 100644 --- a/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/core/lib/Drupal/Core/Config/InstallStorage.php @@ -120,17 +120,17 @@ protected function getAllFolders() { } /** - * Get all configuration names and folders for a list of modules or themes. + * Gets all configuration names and folders for a list of modules or themes. * * @param string $type - * Type of components: 'module' | 'theme' | 'profile' + * Type of components: 'module' | 'theme' | 'profile', which is a string. * @param array $list - * Array of theme or module names. + * An array of theme or module names. * * @return array - * Folders indexed by configuration name. + * An array of folders indexed by configuration name. */ - public function getComponentNames($type, $list) { + public function getComponentNames($type, array $list) { $extension = '.' . $this->getFileExtension(); $folders = array(); foreach ($list as $name) { @@ -147,15 +147,15 @@ public function getComponentNames($type, $list) { } /** - * Get folder inside each component that contains the files. + * Gets folder inside each component that contains the files. * * @param string $type - * Component type: 'module' | 'theme' | 'profile' + * Component type: 'module' | 'theme' | 'profile', which is a string. * @param string $name - * Component name. + * Component name, which is a string. * * @return string - * The configuration folder name for this component. + * The configuration folder name for this component, which is a string. */ protected function getComponentFolder($type, $name) { return drupal_get_path($type, $name) . '/config'; diff --git a/core/lib/Drupal/Core/Config/Metadata/ConfigElement.php b/core/lib/Drupal/Core/Config/Metadata/ConfigElement.php index b3c4479..a5d756e 100644 --- a/core/lib/Drupal/Core/Config/Metadata/ConfigElement.php +++ b/core/lib/Drupal/Core/Config/Metadata/ConfigElement.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Config\Metadata\ConfigElement. + * Contains \Drupal\Core\Config\Metadata\ConfigElement. */ namespace Drupal\Core\Config\Metadata; @@ -21,7 +21,7 @@ class ConfigElement extends ElementBase implements ComplexDataInterface { /** - * Implements Drupal\Core\TypedData\ComplexDataInterface::get(). + * Implements \Drupal\Core\TypedData\ComplexDataInterface::get(). */ public function get($property_name) { if ($property = $this->getElement($property_name)) { @@ -35,7 +35,7 @@ public function get($property_name) { } /** - * Implements Drupal\Core\TypedData\ComplexDataInterface::set(). + * Implements \Drupal\Core\TypedData\ComplexDataInterface::set(). */ public function set($property_name, $value) { // Set the data into the configuration array but behave according to the @@ -55,21 +55,21 @@ public function set($property_name, $value) { } /** - * Implements Drupal\Core\TypedData\ComplexDataInterface::getProperties(). + * Implements \Drupal\Core\TypedData\ComplexDataInterface::getProperties(). */ public function getProperties($include_computed = FALSE) { return $this->toArray(); } /** - * Implements Drupal\Core\TypedData\ComplexDataInterface::getPropertyValues(). + * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyValues(). */ public function getPropertyValues() { return $this->value; } /** - * Implements Drupal\Core\TypedData\ComplexDataInterface::setPropertyValues(). + * Implements \Drupal\Core\TypedData\ComplexDataInterface::setPropertyValues(). */ public function setPropertyValues($values) { foreach ($values as $name => $value) { @@ -79,7 +79,7 @@ public function setPropertyValues($values) { } /** - * Implements Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinition(). + * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinition(). */ public function getPropertyDefinition($name) { $value = isset($this->value[$name]) ? $this->value[$name] : NULL; @@ -89,7 +89,7 @@ public function getPropertyDefinition($name) { } /** - * Implements Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions(). + * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions(). */ public function getPropertyDefinitions() { $list = array(); @@ -100,7 +100,7 @@ public function getPropertyDefinitions() { } /** - * Implements Drupal\Core\TypedData\ComplexDataInterface::isEmpty(). + * Implements \Drupal\Core\TypedData\ComplexDataInterface::isEmpty(). */ public function isEmpty() { return empty($this->value); diff --git a/core/lib/Drupal/Core/Config/Metadata/ElementBase.php b/core/lib/Drupal/Core/Config/Metadata/ElementBase.php index 12e0900..c42dcb0 100644 --- a/core/lib/Drupal/Core/Config/Metadata/ElementBase.php +++ b/core/lib/Drupal/Core/Config/Metadata/ElementBase.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Config\Metadata\ElementBase. + * Contains \Drupal\Core\Config\Metadata\ElementBase. */ namespace Drupal\Core\Config\Metadata; @@ -10,7 +10,6 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Core\TypedData\Type\TypedData; - use ArrayIterator; use IteratorAggregate; @@ -54,7 +53,7 @@ * Gets contained typed data object. * * @param string $key - * Configuration key. + * Configuration key, which is a string. * * @return \Drupal\Core\TypedData\TypedDataInterface|null * The property object or null if the property doesn't exist. @@ -73,7 +72,7 @@ protected function getElement($key) { * Gets the built metadata array for a child element. * * @param string $key - * Key from the configuration data array. + * Key from the configuration data array, which is a string. * * @return array * The metadata for the element, defaults to an empty array. @@ -109,10 +108,10 @@ protected function getAllKeys() { } /** - * Gets typed data properties as array. + * Gets typed data properties as an array. * * @return array - * List of TypedDataInterface objects indexed by key. + * An array of TypedDataInterface objects indexed by key. */ protected function toArray() { $array = array(); @@ -123,7 +122,7 @@ protected function toArray() { } /** - * Implements Drupal\Core\Config\Metadata\ElementInterface::getKey(). + * Implements \Drupal\Core\Config\Metadata\ElementInterface::getKey(). */ public function getKey() { $parent = isset($this->parent) ? $this->parent->getKey() : NULL; @@ -131,28 +130,28 @@ public function getKey() { } /** - * Implements Drupal\Core\Config\Metadata\ElementInterface::getLabel(). + * Implements \Drupal\Core\Config\Metadata\ElementInterface::getLabel(). */ public function getLabel() { return isset($this->definition['label']) ? $this->definition['label'] : $this->getKey(); } /** - * Implements Drupal\Core\Config\Metadata\ElementInterface::getMetadata(). + * Implements \Drupal\Core\Config\Metadata\ElementInterface::getMetadata(). */ public function getMetadata() { return $this->metadata; } /** - * Implements Drupal\Core\Config\Metadata\ElementInterface::setMetadata(). + * Implements \Drupal\Core\Config\Metadata\ElementInterface::setMetadata(). */ public function setMetadata($metadata) { $this->metadata = $metadata; } /** - * Implements Drupal\Core\TypedData\TypedDataInterface::validate(). + * Implements \Drupal\Core\TypedData\TypedDataInterface::validate(). */ public function validate() { // This will be ok if we have any config data at all. @@ -160,29 +159,29 @@ public function validate() { } /** - * Implements Drupal\Core\TypedData\ContextAwareInterface::getName(). + * Implements \Drupal\Core\TypedData\ContextAwareInterface::getName(). */ public function getName() { return $this->key; } /** - * Implements Drupal\Core\TypedData\ContextAwareInterface::setName(). + * Implements \Drupal\Core\TypedData\ContextAwareInterface::setName(). */ public function setName($name) { $this->key = $name; } /** - * Implements Drupal\Core\TypedData\ContextAwareInterface::getParent(). - */ + * Implements \Drupal\Core\TypedData\ContextAwareInterface::getParent(). + */ public function getParent() { return $this->parent; } /** - * Implements Drupal\Core\TypedData\ContextAwareInterface::setParent(). - */ + * Implements \Drupal\Core\TypedData\ContextAwareInterface::setParent(). + */ public function setParent($parent) { $this->parent = $parent; } @@ -238,16 +237,16 @@ public function getIterator() { * @param mixed $value * Configuration data to be used as value. * @param array $metadata - * Metadata for the element. + * Metadata for the element, as an array. * @param string $key - * Nested configuration key to be used as element's name. + * A string, the nested configuration key to be used as element's name. * @param \Drupal\Core\Config\Metadata\ElementInterface $parent * (optional) Element to be used as parent of this one. Defaults to NULL. * * @return \Drupal\Core\TypedData\TypedDataInterface * A TypedDataInterface object containing the configuration value. */ - public static function buildElement($value, $metadata, $key, $parent = NULL) { + public static function buildElement($value, array $metadata, $key, \Drupal\Core\Config\Metadata\ElementInterface $parent = NULL) { $definition = self::buildDefinition($value, $metadata); $context = array('name' => $key, 'parent' => $parent); $element = typed_data()->create($definition, $value, $context); @@ -271,9 +270,9 @@ public static function buildElement($value, $metadata, $key, $parent = NULL) { * The raw metadata array for the element. * * @return array - * The elemement's data definition. + * The elemement's data definition, which is an array. */ - public static function buildDefinition($data, $metadata) { + public static function buildDefinition($data, array $metadata) { $definition = isset($metadata['.definition']) ? $metadata['.definition'] : array(); // If we have a '.list' directive we assume this is a list. if (isset($metadata['.list'])) { @@ -302,7 +301,7 @@ public static function buildDefinition($data, $metadata) { * @return array * The preprocessed metadata array. */ - public static function buildMetadata($data, $metadata) { + public static function buildMetadata($data, array $metadata) { $metadata = self::processInclude($data, $metadata); // Process shorthand '.type', '.label' foreach (array('type', 'label') as $key) { @@ -323,15 +322,21 @@ public static function buildMetadata($data, $metadata) { * This method is called recursively in case the included metadata has also * an '.include' keyword. * + * @param mixed $data + * The configuration data for the element. * @param array $metadata * Metadata array for the element. + * + * @return array + * The processed metadata array. */ - protected static function processInclude($data, $metadata) { + protected static function processInclude($data, array $metadata) { if (isset($metadata['.include'])) { - // Parse the include string for variable names in squae brackets. + // Parse the include string for variable names in square brackets. $name = self::replaceName($metadata['.include'], $data); if ($include = config_metadata($name)) { - // There may be nested '.include' directives, we need to process them too. + // There may be nested '.include' directives, we need to process them + // too. $include = self::processInclude($data, $include); $metadata = NestedArray::mergeDeep($include, $metadata); } @@ -348,11 +353,12 @@ protected static function processInclude($data, $metadata) { * rules defined by the replaceVariable() method. * * @param string $name - * Configuration name with variables in square brackets. + * Configuration name with variables in square brackets, which is a string. * @param mixed $data * Configuration data for the element. + * * @return string - * Configuration name with variables replaced. + * Configuration name with variables replaced, which is a string. */ protected static function replaceName($name, $data) { if (preg_match_all("/\[(.*)\]/U", $name, $matches)) { @@ -385,10 +391,13 @@ protected static function replaceName($name, $data) { * - '%parent.%key', will be replaced by the parent element's key. * * @param string $value - * Variable value to be replaced. + * Variable value to be replaced, which is a string. + * @param mixed $data + * Configuration data for the element. * * @return string - * The replaced value if a replacement found or the original value if not. + * The replaced value, as a string, if a replacement found or the original + * value if not. */ protected static function replaceVariable($value, $data) { $parts = explode('.', $value); diff --git a/core/lib/Drupal/Core/Config/Metadata/ElementInterface.php b/core/lib/Drupal/Core/Config/Metadata/ElementInterface.php index c1d5276..16a35dd 100644 --- a/core/lib/Drupal/Core/Config/Metadata/ElementInterface.php +++ b/core/lib/Drupal/Core/Config/Metadata/ElementInterface.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Config\Metadata\ElementInterface. + * Contains \Drupal\Core\Config\Metadata\ElementInterface. */ namespace Drupal\Core\Config\Metadata; @@ -19,23 +19,23 @@ interface ElementInterface extends Traversable, ArrayAccess, Countable, TypedDataInterface, ContextAwareInterface { /** - * Gets configuration key for this object. + * Gets the configuration key for this object. * * @return string - * Configuration key for this structure. + * Configuration key for this structure, which is a string. */ public function getKey(); /** - * Gets human readable label for this structure or children of it. + * Gets the human readable label for this structure or children of it. * * @return string - * The object label. + * The object label, which is a string. */ public function getLabel(); /** - * Gets raw configuration metadata array for this element. + * Gets the raw configuration metadata array for this element. * * @return array * The full metadata array for this element. @@ -52,6 +52,6 @@ public function getMetadata(); * * @see config_metadata() */ - public function setMetadata($metadata); + public function setMetadata(array $metadata); } diff --git a/core/lib/Drupal/Core/Config/Metadata/ListElement.php b/core/lib/Drupal/Core/Config/Metadata/ListElement.php index 4cb494d..d9f8d7c 100644 --- a/core/lib/Drupal/Core/Config/Metadata/ListElement.php +++ b/core/lib/Drupal/Core/Config/Metadata/ListElement.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Config\Metadata\ListElement. + * Contains \Drupal\Core\Config\Metadata\ListElement. */ namespace Drupal\Core\Config\Metadata; @@ -16,10 +16,12 @@ * configuration data. */ class ListElement extends ElementBase implements ListInterface { + /** - * Implements Drupal\Core\TypedData\ListInterface::isEmpty(). + * Implements \Drupal\Core\TypedData\ListInterface::isEmpty(). */ public function isEmpty() { return empty($this->data); } + } diff --git a/core/lib/Drupal/Core/Config/Metadata/MetadataLookup.php b/core/lib/Drupal/Core/Config/Metadata/MetadataLookup.php index 779005b..d29d8c9 100644 --- a/core/lib/Drupal/Core/Config/Metadata/MetadataLookup.php +++ b/core/lib/Drupal/Core/Config/Metadata/MetadataLookup.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Config\Metadata\MetadataLookup. + * Contains \Drupal\Core\Config\Metadata\MetadataLookup. * * Metadata lives in a modules 'meta' directory, next to the 'config' directory, * which contains the actual configuration. For each configuration file in the @@ -64,13 +64,14 @@ protected function resolveCacheMiss($offset) { } /** - * Gets fallback metadata name. + * Gets the fallback metadata name. * * @param string $name - * Configuration name or key. + * Configuration name or key, which is a string. * * @return string - * Same name with the last part replaced by the filesystem marker. + * Same name as a string with the last part replaced by the filesystem + * marker. */ protected static function getFallbackName($name) { $replaced = preg_replace('/\.[^.]+$/', '.' . self::BASE_MARK, $name); diff --git a/core/lib/Drupal/Core/Config/Metadata/MetadataStorage.php b/core/lib/Drupal/Core/Config/Metadata/MetadataStorage.php index 5f16f41..450d423 100644 --- a/core/lib/Drupal/Core/Config/Metadata/MetadataStorage.php +++ b/core/lib/Drupal/Core/Config/Metadata/MetadataStorage.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Config\Metadata\MetadataStorage. + * Contains \Drupal\Core\Config\Metadata\MetadataStorage. */ namespace Drupal\Core\Config\Metadata; @@ -15,14 +15,14 @@ class MetadataStorage extends InstallStorage { /** - * Implements Drupal\Core\Config\StorageInterface::exists(). + * Implements \Drupal\Core\Config\StorageInterface::exists(). */ public function exists($name) { return array_key_exists($name, $this->getAllFolders()); } /** - * Overrides Drupal\Core\Config\InstallStorage::getComponentFolder(). + * Overrides \Drupal\Core\Config\InstallStorage::getComponentFolder(). */ protected function getComponentFolder($type, $name) { return drupal_get_path($type, $name) . '/meta'; diff --git a/core/lib/Drupal/Core/Config/Metadata/TypedConfig.php b/core/lib/Drupal/Core/Config/Metadata/TypedConfig.php index 42288cf..ded12a5 100644 --- a/core/lib/Drupal/Core/Config/Metadata/TypedConfig.php +++ b/core/lib/Drupal/Core/Config/Metadata/TypedConfig.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Config\Metadata\TypedConfig. + * Contains Drupal\Core\Config\Metadata\TypedConfig. */ namespace Drupal\Core\Config\Metadata; @@ -31,17 +31,17 @@ class TypedConfig extends Config { * Constructs a configuration wrapper object. * * @param string $name - * The configuration object name. + * The configuration object name, which is a string. * @param array $data - * The configuration data. + * The configuration data array. */ - public function __construct($name, $data) { + public function __construct($name, array $data) { $this->name = $name; $this->data = $data; } /** - * Gets data from this config object. + * Gets the data from this config object. * * @return mixed * The data that was requested. @@ -51,7 +51,7 @@ public function getData() { } /** - * Overrides Drupal\Core\Config\Config::setData(). + * Overrides \Drupal\Core\Config\Config::setData(). */ public function setData(array $data) { $this->data = $data; @@ -60,7 +60,7 @@ public function setData(array $data) { } /** - * Overrides Drupal\Core\Config::get(). + * Overrides \Drupal\Core\Config::get(). * * Unlike the get() method of the base configuration object, this one returns * a typed data object instead of raw configuration data. @@ -91,7 +91,7 @@ public function get($key = '') { } /** - * Overrides Drupal\Core\Config\Config::set(). + * Overrides \Drupal\Core\Config\Config::set(). */ public function set($key, $value) { parent::set($key, $value); @@ -100,7 +100,7 @@ public function set($key, $value) { } /** - * Overrides Drupal\Core\Config\Config::clear(). + * Overrides \Drupal\Core\Config\Config::clear(). */ public function clear($key) { parent::clear($key); diff --git a/core/lib/Drupal/Core/Config/Metadata/TypedConfigFactory.php b/core/lib/Drupal/Core/Config/Metadata/TypedConfigFactory.php index aa416ad..7941daf 100644 --- a/core/lib/Drupal/Core/Config/Metadata/TypedConfigFactory.php +++ b/core/lib/Drupal/Core/Config/Metadata/TypedConfigFactory.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Config\Metadata\TypedConfigFactory. + * Contains \Drupal\Core\Config\Metadata\TypedConfigFactory. */ namespace Drupal\Core\Config\Metadata; @@ -25,6 +25,7 @@ class TypedConfigFactory { * Constructs the typed data config factory. * * @param \Drupal\Core\Config\ConfigFactory $config_factory + * Configuration factory object. */ function __construct(ConfigFactory $config_factory) { $this->configFactory = $config_factory; @@ -34,7 +35,7 @@ function __construct(ConfigFactory $config_factory) { * Returns configuration wrapper object to access data as typed properties. * * @param string $name - * Name of the data. + * Name of the data, which is a string. * * @return TypedConfig * The configuration wrapper as an object. diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigMetadataTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigMetadataTest.php index 5c78096..af956e8 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigMetadataTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigMetadataTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\config\Tests\ConfigMetadataTest. + * Contains \Drupal\config\Tests\ConfigMetadataTest. */ namespace Drupal\config\Tests; @@ -63,7 +63,8 @@ function testBasicMetadata() { ); $this->assertEqual($metadata, $expected, 'Retrieved the right metadata for image.style.large'); - // Most complex case, metadata from actual configuration element using includes. + // Most complex case, metadata from actual configuration element using + // includes. $metadata = config_wrapper('image.style.medium')->get('effects.bddf0d06-42f9-4c75-a700-a33cafa25ea0.data')->getMetadata(); // This first element is processed metadata so all the definition will be in // '.definition' array @@ -124,4 +125,3 @@ function testConfigMetadata() { } } - diff --git a/core/modules/contact/meta/contact.category.%.yml b/core/modules/contact/meta/contact.category.%.yml index 6406ff3..30e3e7f 100644 --- a/core/modules/contact/meta/contact.category.%.yml +++ b/core/modules/contact/meta/contact.category.%.yml @@ -11,4 +11,3 @@ reply: weight: .label: 'Weight' .type: integer - diff --git a/core/modules/image/meta/image.effect.image_crop.yml b/core/modules/image/meta/image.effect.image_crop.yml index 9954268..fe4fb48 100644 --- a/core/modules/image/meta/image.effect.image_crop.yml +++ b/core/modules/image/meta/image.effect.image_crop.yml @@ -6,4 +6,3 @@ height: .type: integer anchor: .label: 'Anchor' - diff --git a/core/modules/image/meta/image.effect.image_resize.yml b/core/modules/image/meta/image.effect.image_resize.yml index bde4e33..33d4531 100644 --- a/core/modules/image/meta/image.effect.image_resize.yml +++ b/core/modules/image/meta/image.effect.image_resize.yml @@ -4,4 +4,3 @@ width: height: .label: 'Height' .type: integer - diff --git a/core/modules/image/meta/image.effect.image_rotate.yml b/core/modules/image/meta/image.effect.image_rotate.yml index 7c3a29c..73fc56a 100644 --- a/core/modules/image/meta/image.effect.image_rotate.yml +++ b/core/modules/image/meta/image.effect.image_rotate.yml @@ -5,4 +5,3 @@ bgcolor: random: .label: 'Randomize' .type: boolean - diff --git a/core/modules/image/meta/image.effect.image_scale.yml b/core/modules/image/meta/image.effect.image_scale.yml index 2d3ec8f..b323bde 100644 --- a/core/modules/image/meta/image.effect.image_scale.yml +++ b/core/modules/image/meta/image.effect.image_scale.yml @@ -7,4 +7,3 @@ height: upscale: .label: 'Upscale' .type: boolean - diff --git a/core/modules/image/meta/image.effect.image_scale_and_crop.yml b/core/modules/image/meta/image.effect.image_scale_and_crop.yml index bde4e33..33d4531 100644 --- a/core/modules/image/meta/image.effect.image_scale_and_crop.yml +++ b/core/modules/image/meta/image.effect.image_scale_and_crop.yml @@ -4,4 +4,3 @@ width: height: .label: 'Height' .type: integer - diff --git a/core/modules/image/meta/image.style.%.yml b/core/modules/image/meta/image.style.%.yml index 92bd370..5c3c1dc 100644 --- a/core/modules/image/meta/image.style.%.yml +++ b/core/modules/image/meta/image.style.%.yml @@ -17,4 +17,3 @@ effects: data: .include: 'image.effect.[%parent.name]' .label: 'Data' - diff --git a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php index fb09c0b..3d2fd4a 100644 --- a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php @@ -18,7 +18,6 @@ * $config is always a DrupalConfig object. */ class LocaleConfigSubscriber implements EventSubscriberInterface { - /** * Override configuration values with localized data. * diff --git a/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php b/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php index 1e72c64..11629e0 100644 --- a/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\locale\LocaleTypedConfig. + * Contains \Drupal\locale\LocaleTypedConfig. */ namespace Drupal\locale; @@ -52,14 +52,14 @@ class LocaleTypedConfig extends TypedConfig implements TranslatableInterface { * Constructs a configuration wrapper object. * * @param string $name - * The configuration object name. + * The configuration object name, which is a string. * @param array $data - * The configuration data. + * The configuration data array. * @param \Drupal\locale\StringStorageInterface $localeStorage; * (optional) Locale string storage object that will be used for * translations. */ - public function __construct($name, $data, StringStorageInterface $localeStorage = NULL) { + public function __construct($name, array $data, StringStorageInterface $localeStorage = NULL) { parent::__construct($name, $data); $this->localeStorage = $localeStorage; } @@ -68,9 +68,12 @@ public function __construct($name, $data, StringStorageInterface $localeStorage * Sets translation parameters. * * @param string $langcode - * The language code for the translation. + * The language code for the translation, which is a string. * @param \Drupal\locale\LocaleTypedConfig $source - * Configuration wrapper used as translation source. + * Configuration wrapper object used as translation source. + * + * @return \Drupal\locale\StringStorageInterface + * The storage interface object. */ public function setTranslation($langcode, LocaleTypedConfig $source) { $this->translationLangcode = $langcode; @@ -82,11 +85,11 @@ public function setTranslation($langcode, LocaleTypedConfig $source) { * Checks whether we can translate these languages. * * @param string $from_langcode - * Source language code. + * Source language code, which is a string. * @param string $to_langcode - * Destination language code. + * Destination language code, which is a string. * - * @return boolean + * @return bool * TRUE if this translator supports translations for these languages. */ protected function canTranslate($from_langcode, $to_langcode) { @@ -97,7 +100,7 @@ protected function canTranslate($from_langcode, $to_langcode) { } /** - * Implements Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages(). + * Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages(). */ public function getTranslationLanguages($include_default = TRUE) { $languages = locale_translatable_language_list(); @@ -112,7 +115,7 @@ public function getTranslationLanguages($include_default = TRUE) { } /** - * Implements Drupal\Core\TypedData\TranslatableInterface::getTranslation(). + * Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslation(). */ public function getTranslation($langcode, $strict = TRUE) { if (isset($this->translationSource)) { @@ -132,7 +135,7 @@ public function getTranslation($langcode, $strict = TRUE) { } /** - * Implements Drupal\Core\TypedData\TranslatableInterface::language(). + * Implements \Drupal\Core\TypedData\TranslatableInterface::language(). */ public function language() { if (isset($this->translationLangcode)) { @@ -144,7 +147,7 @@ public function language() { } /** - * Get translated configuration data. + * Gets the translated configuration data. * * @param \Traversable $elements * Configuration elements. @@ -152,9 +155,9 @@ public function language() { * Array with options that will depend on the translator used. * * @return array - * Configuration data translated to the requested language. + * An array of configuration data translated to the requested language. */ - protected function getTranslatedData($elements, $options) { + protected function getTranslatedData($elements, array $options) { $strict = !empty($options['strict']); $translation = array(); foreach ($elements as $key => $element) { @@ -185,14 +188,14 @@ protected function getTranslatedData($elements, $options) { * - 'locale context', to define the string context. * * @param \Drupal\Core\TypedData\TypedDataInterface $element - * Configuration element. + * Configuration element object. * @param array $options - * Array with translation options that are dependent on the translator. + * An array with translation options that are dependent on the translator. * * @return bool * Whether the element fits the translation criteria. */ - public function translateElement($element, $options) { + public function translateElement(\Drupal\Core\TypedData\TypedDataInterface $element, array $options) { if ($this->canTranslate($options['source'], $options['target'])) { $definition = $element->getDefinition(); $value = $element->getValue(); @@ -217,13 +220,13 @@ public function translateElement($element, $options) { * tables only if this is marked as default data. * * @param string $langcode - * Language code to translate to. + * Language code to translate to, which is a string. * @param string $source * The source string. * @param string $context - * The string context. + * The string context, which is a string. * - * @return string|bool + * @return string|false * Translated string if there is a translation, FALSE if not. */ protected function translateString($langcode, $source, $context) { diff --git a/core/modules/locale/lib/Drupal/locale/StringStorageInterface.php b/core/modules/locale/lib/Drupal/locale/StringStorageInterface.php index 0fb26ad..d02774f 100644 --- a/core/modules/locale/lib/Drupal/locale/StringStorageInterface.php +++ b/core/modules/locale/lib/Drupal/locale/StringStorageInterface.php @@ -79,7 +79,7 @@ public function getLocations(array $conditions = array()); * (optional) Array with conditions that will be used to filter the strings * returned and may include all of the conditions defined by getStrings(). * - * @return \Drupal\locale\SourceString|null + * @return Drupal\locale\SourceString|null * Minimal TranslationString object if found, NULL otherwise. */ public function findString(array $conditions); @@ -95,7 +95,7 @@ public function findString(array $conditions); * (optional) Array with conditions that will be used to filter the strings * returned and may include all of the conditions defined by getStrings(). * - * @return \Drupal\locale\TranslationString|null + * @return Drupal\locale\TranslationString|null * Minimal TranslationString object if found, NULL otherwise. */ public function findTranslation(array $conditions); @@ -103,13 +103,13 @@ public function findTranslation(array $conditions); /** * Save string object to storage. * - * @param \Drupal\locale\StringInterface $string + * @param Drupal\locale\StringInterface $string * The string object. * - * @return \Drupal\locale\StringStorageInterface + * @return Drupal\locale\StringStorageInterface * The called object. * - * @throws \Drupal\locale\StringStorageException + * @throws Drupal\locale\StringStorageException * In case of failures, an exception is thrown. */ public function save($string); @@ -117,13 +117,13 @@ public function save($string); /** * Delete string from storage. * - * @param \Drupal\locale\StringInterface $string + * @param Drupal\locale\StringInterface $string * The string object. * - * @return \Drupal\locale\StringStorageInterface + * @return Drupal\locale\StringStorageInterface * The called object. * - * @throws \Drupal\locale\StringStorageException + * @throws Drupal\locale\StringStorageException * In case of failures, an exception is thrown. */ public function delete($string); @@ -166,7 +166,7 @@ public function countTranslations(); * @param array $values * (optional) Array with initial values. Defaults to empty array. * - * @return \Drupal\locale\SourceString + * @return Drupal\locale\SourceString * New source string object. */ public function createString($values = array()); @@ -177,7 +177,7 @@ public function createString($values = array()); * @param array $values * (optional) Array with initial values. Defaults to empty array. * - * @return \Drupal\locale\TranslationString + * @return Drupal\locale\TranslationString * New string translation object. */ public function createTranslation($values = array()); diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php index 5ba78b8..bb0bd95 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\locale\Tests\LocaleConfigTranslationTest. + * Contains \Drupal\locale\Tests\LocaleConfigTranslationTest. */ namespace Drupal\locale\Tests; @@ -41,7 +41,7 @@ function setUp() { * Tests basic configuration translation. */ function testConfigTranslation() { - // Add custom language + // Add custom language. $langcode = 'xx'; $admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'translate interface', 'administer modules')); $this->drupalLogin($admin_user); @@ -100,7 +100,7 @@ function testConfigTranslation() { $string = $this->storage->findString(array('source' => 'Medium (220x220)', 'context' => '', 'type' => 'configuration')); $this->assertFalse($string, 'Configuration strings have been created upon installation.'); - // Enable the image module + // Enable the image module. $this->drupalPost('admin/modules', array('modules[Core][image][enable]' => "1"), t('Save configuration')); $this->resetAll(); diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index 3802538..5e7cd18 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -538,11 +538,10 @@ function locale_translate_batch_import($filepath, $options, &$context) { * An array with options that can have the following elements: * - 'refresh_configuration': Whether or not to refresh Configuration strings * after the import. Optional, defaults to FALSE. - * * @param array $context * Contains a list of strings updated and information about the progress. */ -function locale_translate_batch_refresh($options, &$context) { +function locale_translate_batch_refresh(array $options, array &$context) { if (!isset($context['sandbox']['refresh'])) { $strings = $langcodes = array(); if (isset($context['results']['stats'])) { @@ -692,7 +691,7 @@ function locale_translate_delete_translation_files($langcode) { } /** - * Build a locale batch to refresh configuration. + * Builds a locale batch to refresh configuration. * * @param array $options * An array with options that can have the following elements: @@ -705,9 +704,9 @@ function locale_translate_delete_translation_files($langcode) { * is an empty array, it will update all components. * * @return array - * The batch definition. + * The batch definition array. */ -function locale_config_batch_update_components($options, $components = array()) { +function locale_config_batch_update_components(array $options, array $components = array()) { $langcodes = isset($options['langcode']) ? array($options['langcode']) : array_keys(locale_translatable_language_list()); if ($langcodes && $names = _locale_config_component_names($components)) { return locale_config_batch_build($names, $langcodes, $options); @@ -718,9 +717,9 @@ function locale_config_batch_update_components($options, $components = array()) * Creates a locale batch to refresh specific configuration. * * @param array $names - * List of configuration object names to update. + * List of configuration object names to update, which is an array. * @param array $langcodes - * List of language codes to refresh. + * List of language codes to refresh, which is an array. * @param array $options * An array with options that can have the following elements: * - 'finish_feedback': Whether or not to give feedback to the user when the @@ -729,18 +728,18 @@ function locale_config_batch_update_components($options, $components = array()) * @return array * The batch definition. */ -function locale_config_batch_build($names, $langcodes, $options = array()) { +function locale_config_batch_build(array $names, array $langcodes, array $options = array()) { $options += array('finish_feedback' => TRUE); $t = get_t(); foreach ($names as $name) { $operations[] = array('locale_config_batch_refresh_name', array($name, $langcodes)); } $batch = array( - 'operations' => $operations, - 'title' => $t('Updating configuration translations'), - 'init_message' => $t('Starting update'), - 'error_message' => $t('Error updating configuration translations'), - 'file' => drupal_get_path('module', 'locale') . '/locale.bulk.inc', + 'operations' => $operations, + 'title' => $t('Updating configuration translations'), + 'init_message' => $t('Starting update'), + 'error_message' => $t('Error updating configuration translations'), + 'file' => drupal_get_path('module', 'locale') . '/locale.bulk.inc', ); if (!empty($options['finish_feedback'])) { $batch['completed'] = 'locale_config_batch_finished'; @@ -749,16 +748,16 @@ function locale_config_batch_build($names, $langcodes, $options = array()) { } /** - * Perform configuration translation refresh as a batch step. + * Refreshes the configuration translation as a batch step. * * @param array $name - * Name of configuration object to update. + * Name of configuration object to update, which is an array. * @param array $langcodes * (optional) Array of language codes to update. Defaults to all languages. - * @param $context - * Contains a list of files imported. + * @param array $context + * An array that contains a list of files imported. */ -function locale_config_batch_refresh_name($name, $langcodes, &$context) { +function locale_config_batch_refresh_name(array $name, array $langcodes, array &$context) { if (!isset($context['result']['stats']['configuration'])) { $context['result']['stats']['configuration'] = 0; } @@ -769,14 +768,14 @@ function locale_config_batch_refresh_name($name, $langcodes, &$context) { } /** - * Finished callback of system page locale import batch. + * Batch callback: Displays status of finished system page locale import batch. * * @param bool $success * Information about the success of the batch import. * @param array $results - * Information about the results of the batch import. + * An array of information about the results of the batch import. */ -function locale_config_batch_finished($success, $results) { +function locale_config_batch_finished(bool $success, array $results) { if ($success) { $configuration = isset($results['stats']['configuration']) ? $results['stats']['configuration'] : 0; if ($configuration) { @@ -791,10 +790,10 @@ function locale_config_batch_finished($success, $results) { } /** - * Delete configuration for language. + * Deletes the configuration for a language. * - * @param $langcode - * Language code to delete. + * @param string $langcode + * Language code to delete, which is a string. */ function locale_config_delete_language($langcode) { $locale_name = 'locale.config.' . $langcode; @@ -805,16 +804,17 @@ function locale_config_delete_language($langcode) { } /** - * Update all configuration for names / languages. + * Updates all configuration for names / languages. * * @param array $names - * Array of names of configuration objects to update. + * An array of names of configuration objects to update. * @param array $langcodes - * (optional) Array of language codes to update. Defaults to all languages. + * (optional) An array of language codes to update. Defaults to all languages. + * * @return int - * Number of configuration objects retranslated. + * Number of configuration objects retranslated, which is an integer. */ -function locale_config_update_multiple($names, $langcodes = array()) { +function locale_config_update_multiple(array $names, array $langcodes = array()) { $default_storage = new InstallStorage(); $config_storage = drupal_container()->get('config.storage'); $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list()); @@ -848,17 +848,17 @@ function locale_config_update_multiple($names, $langcodes = array()) { } /** - * Compare default configuration with updated data. + * Compares the default configuration with updated data. * * @param array $default - * Default configuration data. + * Default configuration data array. * @param array $updated - * Current configuration data. + * Current configuration data array. * * @return array - * The elements of default configuration that haven't changed. + * An array of the elements of default configuration that haven't changed. */ -function _locale_config_data_compare($default, $updated) { +function _locale_config_data_compare(array $default, array $updated) { // Speed up comparison, specially for install operations. if ($default === $updated) { return $default; @@ -878,12 +878,12 @@ function _locale_config_data_compare($default, $updated) { } /** - * Delete configuration for uninstalled components. + * Deletes the configuration for uninstalled components. * * @param array $components - * Array with string identifiers. + * An array of string identifiers. */ -function locale_config_delete_components($components) { +function locale_config_delete_components(array $components) { $names = _locale_config_component_names($components); $langcodes = array_keys(locale_translatable_language_list()); if ($names && $langcodes) { @@ -897,15 +897,15 @@ function locale_config_delete_components($components) { } /** - * Get configuration names associated with components. + * Gets the configuration names associated with components. * * @param array $components - * Array with string identifiers. + * An array with string identifiers. * * @return array - * Array of configuration object names. + * An array of configuration object names. */ -function _locale_config_component_names($components) { +function _locale_config_component_names(array $components) { $storage = new InstallStorage(); if ($components) { $names = array(); @@ -922,15 +922,15 @@ function _locale_config_component_names($components) { } /** - * Get configuration names associated with strings. + * Gets the configuration names associated with strings. * * @param array $lids - * Array with string identifiers. + * An array with location string identifiers. * * @return array - * Array of configuration object names. + * An array of configuration object names. */ -function _locale_config_string_names($lids) { +function _locale_config_string_names(array $lids) { $names = array(); $locations = locale_storage()->getLocations(array('sid' => $lids, 'type' => 'configuration')); foreach ($locations as $location) { diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index a0d695a..62da4ef 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -450,7 +450,7 @@ function locale_themes_enabled($themes) { * This function will either import translation for the component change * right away, or start a batch if more files need to be imported. * - * @param $components + * @param array $components * An array of arrays of component (theme and/or module) names to import * translations for, indexed by type. * @@ -460,7 +460,7 @@ function locale_themes_enabled($themes) { * identification, we should revisit and only import files for the * identified projects for the components. */ -function locale_system_update($components) { +function locale_system_update(array $components) { // Skip running the translation imports if in the installer, // because it would break out of the installer flow. We have // built-in support for translation imports in the installer. @@ -808,16 +808,17 @@ function _locale_refresh_translations($langcodes, $lids) { } /** - * Refresh configuration after string translations have been updated. + * Refreshes configuration after string translations have been updated. * * The information that will be refreshed includes: * - JavaScript translations. * - Locale cache. * * @param array $langcodes - * Language codes for updated translations. + * An array of language codes for updated translations. * @param array $lids - * List of string identifiers that have been updated / created. + * List of string identifiers that have been updated or created, which is an + * array. */ function _locale_refresh_configuration($langcodes, $lids) { if ($lids && $langcodes) { diff --git a/core/modules/system/meta/system.maintenance.yml b/core/modules/system/meta/system.maintenance.yml index 2b0922a..96be6e2 100644 --- a/core/modules/system/meta/system.maintenance.yml +++ b/core/modules/system/meta/system.maintenance.yml @@ -4,4 +4,3 @@ enabled: message: .label: 'Message to display when in maintenance mode' .type: text - diff --git a/core/modules/system/meta/system.site.yml b/core/modules/system/meta/system.site.yml index 483e22a..e1477e7 100644 --- a/core/modules/system/meta/system.site.yml +++ b/core/modules/system/meta/system.site.yml @@ -14,4 +14,3 @@ page: .label: 'Default 404 (not found) page' front: .label: 'Default front page' - diff --git a/core/modules/user/meta/user.mail.yml b/core/modules/user/meta/user.mail.yml index ad75311..bd0ecfb 100644 --- a/core/modules/user/meta/user.mail.yml +++ b/core/modules/user/meta/user.mail.yml @@ -7,4 +7,3 @@ body: .label: 'Body' .type: text -