You are here

function _feeds_filter_callback_arrays in Feeds 7.2

Filters the callbacks of a single target array.

Parameters

array &$target: The target arary.

1 call to _feeds_filter_callback_arrays()
feeds_normalize_targets in ./feeds.feeds.inc
Normalizes the target array.

File

./feeds.feeds.inc, line 62
Feeds hooks.

Code

function _feeds_filter_callback_arrays(array &$target) {

  // Migrate keys summary_callback and form_callback to the new keys.
  if (isset($target['summary_callback'])) {
    $target['summary_callbacks'][] = $target['summary_callback'];
  }
  if (isset($target['form_callback'])) {
    $target['form_callbacks'][] = $target['form_callback'];
  }
  unset($target['summary_callback'], $target['form_callback']);
  static $callback_keys = array(
    'summary_callbacks',
    'form_callbacks',
    'preprocess_callbacks',
    'unique_callbacks',
  );

  // Filter out any incorrect callbacks. Do it here so it only has to be done
  // once.
  foreach ($callback_keys as $callback_key) {
    $target[$callback_key] = array_filter($target[$callback_key], 'is_callable');
  }

  // This makes checking in FeedsProcessor::mapToTarget() simpler.
  if (empty($target['callback']) || !is_callable($target['callback'])) {
    unset($target['callback']);
  }
}