You are here

function content_array_flatten in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 content.module \content_array_flatten()

Helper function to flatten an array of allowed values.

Parameters

$array: A single or multidimensional array.

Return value

A flattened array.

1 call to content_array_flatten()
content_allowed_values in ./content.module
Create an array of the allowed values for this field.

File

./content.module, line 1654
Allows administrators to associate custom fields to content types.

Code

function content_array_flatten($array) {
  $result = array();
  if (is_array($array)) {
    foreach ($array as $key => $value) {
      if (is_array($value)) {
        $result += content_array_flatten($value);
      }
      else {
        $result[$key] = $value;
      }
    }
  }
  return $result;
}