You are here

public static function MigrateDestinationEntity::array_flatten in Migrate 7.2

Flattens an array of allowed values.

Duplicates options_array_flatten() to avoid a dependency on the core options module.

Parameters

$array: A single or multidimensional array.

Return value

A flattened array.

1 call to MigrateDestinationEntity::array_flatten()
MigrateDestinationEntity::fieldAttachValidate in plugins/destinations/entity.inc
Perform field validation against the field data in an entity. Wraps field_attach_validate to handle exceptions cleanly and provide maximum information for identifying the cause of validation errors.

File

plugins/destinations/entity.inc, line 225
Defines base for migration destinations implemented as Drupal entities.

Class

MigrateDestinationEntity
Abstract base class for entity-based destination handling. Holds common Field API-related functions.

Code

public static function array_flatten($array) {
  $result = array();
  if (is_array($array)) {
    foreach ($array as $key => $value) {
      if (is_array($value)) {
        $result += self::array_flatten($value);
      }
      else {
        $result[$key] = $value;
      }
    }
  }
  return $result;
}