You are here

function _drupal_rewrite_settings_dump in Drupal 8

Same name and namespace in other branches
  1. 9 core/includes/install.inc \_drupal_rewrite_settings_dump()
  2. 10 core/includes/install.inc \_drupal_rewrite_settings_dump()

Helper for drupal_rewrite_settings().

Dump the relevant value properties.

Parameters

array|object $variable: The container for variable values.

string $variable_name: Name of variable.

Return value

string A string containing valid PHP code of the variable suitable for placing into settings.php.

1 call to _drupal_rewrite_settings_dump()
drupal_rewrite_settings in core/includes/install.inc
Replaces values in settings.php with values in the submitted array.

File

core/includes/install.inc, line 486
API functions for installing modules and themes.

Code

function _drupal_rewrite_settings_dump($variable, $variable_name) {
  $return = '';
  if (is_object($variable)) {
    if (!empty($variable->required)) {
      $return .= _drupal_rewrite_settings_dump_one($variable, "{$variable_name} = ", "\n");
    }
  }
  else {
    foreach ($variable as $k => $v) {
      $return .= _drupal_rewrite_settings_dump($v, $variable_name . "['" . $k . "']");
    }
  }
  return $return;
}