You are here

function view_mode_page_array_replace in View Mode Page 7.2

Same name and namespace in other branches
  1. 8.2 view_mode_page.module \view_mode_page_array_replace()

A wrapper around PHP's array_replace function

This also fills in a custom function in case this is used with PHP 5.2.

3 calls to view_mode_page_array_replace()
ViewModePageTestCase::testArrayReplaceWithNoValues in ./view_mode_page.test
Test array_replace wrapper
ViewModePageTestCase::testArrayReplaceWithOverrides in ./view_mode_page.test
Test array_replace wrapper
view_mode_page_assert_settings in ./view_mode_page.module
Check the arguments for new array-based parameters

File

./view_mode_page.module, line 453
View Mode Page module allows users to add a page for a specific view mode.

Code

function view_mode_page_array_replace($defaults, $settings) {
  if (function_exists('array_replace')) {
    return array_replace($defaults, $settings);
  }

  // php 5.2 behavior
  $array = $defaults;
  foreach ($settings as $key => $value) {
    $array[$key] = $value;
  }
  return $array;
}