class MarkdownConfig in Markdown 8.2
Markdown Config.
Hierarchy
- class \Drupal\Core\Config\ConfigBase implements RefinableCacheableDependencyInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\Core\Config\StorableConfigBase
- class \Drupal\Core\Config\Config
- class \Drupal\markdown\Config\MarkdownConfig implements ContainerInjectionInterface
- class \Drupal\Core\Config\Config
- class \Drupal\Core\Config\StorableConfigBase
Expanded class hierarchy of MarkdownConfig
Deprecated
in markdown:8.x-2.0 and is removed from markdown:3.0.0. Use \Drupal\markdown\Form\ParserConfigurationForm instead.
See also
https://www.drupal.org/project/markdown/issues/3142418
1 file declares its use of MarkdownConfig
- SettingsForm.php in src/
Form/ SettingsForm.php
File
- src/
Config/ MarkdownConfig.php, line 19
Namespace
Drupal\markdown\ConfigView source
class MarkdownConfig extends Config implements ContainerInjectionInterface {
/**
* The prefix to prepend all keys with.
*
* Note: this is primarily for use when the config is wrapped inside
* higher levels of config.
*
* @var string
*/
protected $keyPrefix;
/**
* {@inheritdoc}
*/
public function __construct($name, StorageInterface $storage, EventDispatcherInterface $event_dispatcher, TypedConfigManagerInterface $typed_config, array $data = NULL) {
parent::__construct($name, $storage, $event_dispatcher, $typed_config);
if (isset($data)) {
$this
->initWithData($data);
}
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container = NULL, $name = NULL, array $data = NULL) {
if (!$container) {
$container = \Drupal::getContainer();
}
return new static($name, $container
->get('config.storage'), $container
->get('event_dispatcher'), $container
->get('config.typed'), $data);
}
/**
* Creates a new instance using provided data or loading existing config data.
*
* @param string $name
* The config name where the data is stored.
* @param array $data
* Optional. Initial data to use.
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* Optional. The service container this instance should use.
*
* @return static
*/
public static function load($name, array $data = NULL, ContainerInterface $container = NULL) {
if (!isset($data)) {
$data = \Drupal::config($name)
->getRawData();
}
return static::create($container, $name, $data);
}
/**
* Retrieves the key prefix, if any.
*
* @return string|null
* The key prefix, if set.
*/
public function getKeyPrefix() {
return $this->keyPrefix;
}
/**
* Prefixes a key, if a prefix is set.
*
* @param string $key
* The key to prefix.
*
* @return string
* The prefixed key.
*/
protected function prefixKey($key) {
if ($prefix = $this
->getKeyPrefix()) {
if (($pos = strpos($key, "{$prefix}.")) === 0) {
$key = substr($key, strlen("{$prefix}."));
}
$key = "{$prefix}.{$key}";
}
return $key;
}
/**
* Prefixes keys of an associative array of data.
*
* @param array $data
* The data to iterate over.
*
* @return array
* The data with prefixed keys.
*/
protected function prefixKeys(array $data) {
$prefixed = [];
foreach ($data as $key => $value) {
$prefixed[$this
->prefixKey($key)] = $value;
}
return $prefixed;
}
/**
* Sets the key prefix.
*
* @param string $keyPrefix
* The key prefix to set.
*
* @return static
*/
public function setKeyPrefix($keyPrefix) {
$this->keyPrefix = rtrim($keyPrefix, '.');
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
Config:: |
protected | property | An event dispatcher instance to use for configuration events. | |
Config:: |
protected | property | The current module overrides. | |
Config:: |
protected | property | The current runtime data. | |
Config:: |
protected | property | The current settings overrides. | |
Config:: |
public | function |
Unsets a value in this configuration object. Overrides ConfigBase:: |
1 |
Config:: |
public | function |
Deletes the configuration object. Overrides StorableConfigBase:: |
1 |
Config:: |
public | function |
Gets data from this configuration object. Overrides ConfigBase:: |
|
Config:: |
public | function | Gets original data from this configuration object. | |
Config:: |
public | function | Gets the raw data without overrides. | |
Config:: |
public | function | Determines if overrides are applied to a key for this configuration object. | |
Config:: |
public | function |
Initializes a configuration object with pre-loaded data. Overrides StorableConfigBase:: |
|
Config:: |
protected | function | Resets the current data, so overrides are re-applied. | |
Config:: |
public | function |
Saves the configuration object. Overrides StorableConfigBase:: |
1 |
Config:: |
public | function |
Sets a value in this configuration object. Overrides ConfigBase:: |
1 |
Config:: |
public | function |
Replaces the data of this configuration object. Overrides ConfigBase:: |
|
Config:: |
public | function | Sets module overrides for this configuration object. | |
Config:: |
protected | function | Sets the current data for this configuration object. | |
Config:: |
public | function | Sets settings.php overrides for this configuration object. | |
ConfigBase:: |
protected | property | The data of the configuration object. | |
ConfigBase:: |
protected | property | The name of the configuration object. | |
ConfigBase:: |
protected | function | Casts any objects that implement MarkupInterface to string. | |
ConfigBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyTrait:: |
|
ConfigBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyTrait:: |
|
ConfigBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyTrait:: |
1 |
ConfigBase:: |
public | function | Returns the name of this configuration object. | |
ConfigBase:: |
constant | The maximum length of a configuration object name. | ||
ConfigBase:: |
public | function | Merges data into a configuration object. | |
ConfigBase:: |
public | function | Sets the name of this configuration object. | |
ConfigBase:: |
protected | function | Validates all keys in a passed in config array structure. | |
ConfigBase:: |
public static | function | Validates the configuration object name. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MarkdownConfig:: |
protected | property | The prefix to prepend all keys with. | |
MarkdownConfig:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
MarkdownConfig:: |
public | function | Retrieves the key prefix, if any. | |
MarkdownConfig:: |
public static | function | Creates a new instance using provided data or loading existing config data. | |
MarkdownConfig:: |
protected | function | Prefixes a key, if a prefix is set. | |
MarkdownConfig:: |
protected | function | Prefixes keys of an associative array of data. | |
MarkdownConfig:: |
public | function | Sets the key prefix. | |
MarkdownConfig:: |
public | function |
Constructs a configuration object. Overrides Config:: |
|
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
StorableConfigBase:: |
protected | property | Whether the configuration object is new or has been saved to the storage. | |
StorableConfigBase:: |
protected | property | The data of the configuration object. | |
StorableConfigBase:: |
protected | property | The config schema wrapper object for this configuration object. | |
StorableConfigBase:: |
protected | property | The storage used to load and save this configuration object. | |
StorableConfigBase:: |
protected | property | The typed config manager. | |
StorableConfigBase:: |
protected | function | Casts the value to correct data type using the configuration schema. | |
StorableConfigBase:: |
protected | function | Gets the schema wrapper for the whole configuration object. | |
StorableConfigBase:: |
public | function | Retrieves the storage used to load and save this configuration object. | |
StorableConfigBase:: |
public | function | Returns whether this configuration object is new. | |
StorableConfigBase:: |
protected | function | Validate the values are allowed data types. |