function StorableConfigBase::getOriginal

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Config/StorableConfigBase.php \Drupal\Core\Config\StorableConfigBase::getOriginal()

Gets original data from this configuration object.

Original data is the data as it is immediately after loading from configuration storage before any changes. If this is a new configuration object it will be an empty array.

Parameters

string $key: A string that maps to a key within the configuration data.

Return value

mixed The data that was requested.

See also

\Drupal\Core\Config\Config::get()

1 method overrides StorableConfigBase::getOriginal()
Config::getOriginal in core/lib/Drupal/Core/Config/Config.php
Gets original data from this configuration object.

File

core/lib/Drupal/Core/Config/StorableConfigBase.php, line 140

Class

StorableConfigBase
Provides a base class for configuration objects with storage support.

Namespace

Drupal\Core\Config

Code

public function getOriginal($key = '') {
    $original_data = $this->originalData;
    if (empty($key)) {
        return $original_data;
    }
    $parts = explode('.', $key);
    if (count($parts) == 1) {
        return $original_data[$key] ?? NULL;
    }
    $value = NestedArray::getValue($original_data, $parts, $key_exists);
    return $key_exists ? $value : NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.