LocaleConfigManager::filterOverride

protected LocaleConfigManager::filterOverride(array $override_data, array $translatable)

Filters override data based on default translatable items.

Parameters

array $override_data: Configuration override data.

array $translatable: Translatable data array. @see self::getTranslatableData()

Return value

array Nested array of any items of $override_data which did not have keys in $translatable. May be empty if $override_data only had items which were also in $translatable.

File

core/modules/locale/src/LocaleConfigManager.php, line 631

Class

LocaleConfigManager
Manages configuration supported in part by interface translation.

Namespace

Drupal\locale

Code

protected function filterOverride(array $override_data, array $translatable) {
  $filtered_data = array();
  foreach ($override_data as $key => $value) {
    if (isset($translatable[$key])) {
      // If the translatable default configuration has this key, look further
      // for subkeys or ignore this element for scalar values.
      if (is_array($value)) {
        $value = $this->filterOverride($value, $translatable[$key]);
        if (!empty($value)) {
          $filtered_data[$key] = $value;
        }
      }
    }
    else {
      // If this key was not in the translatable default configuration,
      // keep it.
      $filtered_data[$key] = $value;
    }
  }
  return $filtered_data;
}
doc_Drupal
2016-10-29 09:23:53
Comments
Leave a Comment

Please login to continue.