comparison core/lib/Drupal/Core/Config/Config.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children c2387f117808
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
301 return $key_exists ? $value : NULL; 301 return $key_exists ? $value : NULL;
302 } 302 }
303 } 303 }
304 } 304 }
305 305
306 /**
307 * Determines if overrides are applied to a key for this configuration object.
308 *
309 * @param string $key
310 * (optional) A string that maps to a key within the configuration data.
311 * For instance in the following configuration array:
312 * @code
313 * array(
314 * 'foo' => array(
315 * 'bar' => 'baz',
316 * ),
317 * );
318 * @endcode
319 * A key of 'foo.bar' would map to the string 'baz'. However, a key of 'foo'
320 * would map to the array('bar' => 'baz').
321 * If not supplied TRUE will be returned if there are any overrides at all
322 * for this configuration object.
323 *
324 * @return bool
325 * TRUE if there are any overrides for the key, otherwise FALSE.
326 */
327 public function hasOverrides($key = '') {
328 if (empty($key)) {
329 return !(empty($this->moduleOverrides) && empty($this->settingsOverrides));
330 }
331 else {
332 $parts = explode('.', $key);
333 $override_exists = FALSE;
334 if (isset($this->moduleOverrides) && is_array($this->moduleOverrides)) {
335 $override_exists = NestedArray::keyExists($this->moduleOverrides, $parts);
336 }
337 if (!$override_exists && isset($this->settingsOverrides) && is_array($this->settingsOverrides)) {
338 $override_exists = NestedArray::keyExists($this->settingsOverrides, $parts);
339 }
340 return $override_exists;
341 }
342 }
343
306 } 344 }