You are here

private function CourseHandler::optionsMerge in Course 3.x

Same name and namespace in other branches
  1. 8.3 src/Helper/CourseHandler.php \Drupal\course\Helper\CourseHandler::optionsMerge()
  2. 8.2 src/Helper/CourseHandler.php \Drupal\course\Helper\CourseHandler::optionsMerge()

Merge arrays with replace, not append.

See also

http://www.php.net/manual/en/function.array-merge-recursive.php#102379

1 call to CourseHandler::optionsMerge()
CourseHandler::addOptions in src/Helper/CourseHandler.php
Merge an array of options onto the existing options.

File

src/Helper/CourseHandler.php, line 150

Class

CourseHandler
Master class for a course related content entity.

Namespace

Drupal\course\Helper

Code

private function optionsMerge($Arr1, $Arr2) {
  foreach ($Arr2 as $key => $Value) {
    if (array_key_exists($key, $Arr1) && is_array($Value)) {
      $Arr1[$key] = $this
        ->optionsMerge($Arr1[$key], $Arr2[$key]);
    }
    else {
      $Arr1[$key] = $Value;
    }
  }
  return $Arr1;
}