You are here

public function backup_migrate_item::_merge_defaults in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.3 includes/crud.inc \backup_migrate_item::_merge_defaults()
  2. 6.3 includes/crud.inc \backup_migrate_item::_merge_defaults()
  3. 6.2 includes/crud.inc \backup_migrate_item::_merge_defaults()

Merge parameters with the given defaults.

Works like array_merge_recursive, but it doesn't turn scalar values into arrays.

1 call to backup_migrate_item::_merge_defaults()
backup_migrate_item::__construct in includes/crud.inc
Set the basic info pulled from the db or generated programatically.

File

includes/crud.inc, line 443
CRUD functions for backup and migrate types (schedules, profiles etc.).

Class

backup_migrate_item
A base class for items which can be stored in the database.

Code

public function _merge_defaults($params, $defaults) {
  foreach ($defaults as $key => $val) {
    if (!isset($params[$key])) {
      $params[$key] = $val;
    }
    elseif (is_array($params[$key])) {
      $params[$key] = $this
        ->_merge_defaults($params[$key], $val);
    }
  }
  return $params;
}