You are here

function hook_feeds_processor_targets_alter in Feeds 7.2

Same name and namespace in other branches
  1. 8.2 feeds.api.php \hook_feeds_processor_targets_alter()
  2. 7 feeds.api.php \hook_feeds_processor_targets_alter()

Alters the target array.

This hook allows modifying the target array.

Parameters

array &$targets: Array containing the targets to be offered to the user. Add to this array to expose additional options.

string $entity_type: The entity type of the target, for instance a 'node' entity.

string $bundle: The entity bundle to return targets for.

See also

hook_feeds_processor_targets()

Related topics

3 functions implement hook_feeds_processor_targets_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

feeds_feeds_processor_targets_alter in ./feeds.feeds.inc
Implements hook_feeds_processor_targets_alter().
feeds_tests_feeds_processor_targets_alter in tests/feeds_tests.module
Implements hook_feeds_processor_targets_alter().
locale_feeds_processor_targets_alter in mappers/locale.inc
Implements hook_feeds_processor_targets_alter().
1 invocation of hook_feeds_processor_targets_alter()
FeedsProcessor::getHookTargets in plugins/FeedsProcessor.inc
Allows other modules to expose targets.

File

./feeds.api.php, line 431
Documentation of Feeds hooks.

Code

function hook_feeds_processor_targets_alter(array &$targets, $entity_type, $bundle) {

  // Example: set an existing target as optional unique.
  if ($entity_type == 'node' && $bundle == 'article') {
    if (isset($targets['nid'])) {
      $targets['nid']['unique_callbacks'][] = 'my_module_mapper_unique';
      $targets['nid']['optional_unique'] = TRUE;
    }
  }
}