You are here

function hook_feeds_processor_targets_alter in Feeds 7

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

Alter mapping targets for entities. Use this hook to add additional target options to the mapping form of Node processors.

If the key in $targets[] does not correspond to the actual key on the node object ($node->key), real_target MUST be specified. See mappers/link.inc

For an example implementation, see mappers/content.inc

Parameters

&$targets: Array containing the targets to be offered to the user. Add to this array to expose additional options. Remove from this array to suppress options. Remove with caution.

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

$content_type: The content type of the target node.

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.

field_feeds_processor_targets_alter in mappers/field.inc
Implements hook_feeds_processor_targets_alter().
file_feeds_processor_targets_alter in mappers/file.inc
Implements hook_feeds_processor_targets_alter().
taxonomy_feeds_processor_targets_alter in mappers/taxonomy.inc
Implements hook_feeds_processor_targets_alter().

File

./feeds.api.php, line 192

Code

function hook_feeds_processor_targets_alter(&$targets, $entity_type, $content_type) {
  if ($entity_type == 'node') {
    $targets['my_node_field'] = array(
      'name' => t('My custom node field'),
      'description' => t('Description of what my custom node field does.'),
      'callback' => 'my_module_set_target',
    );
    $targets['my_node_field2'] = array(
      'name' => t('My Second custom node field'),
      'description' => t('Description of what my second custom node field does.'),
      'callback' => 'my_module_set_target2',
      'real_target' => 'my_node_field_two',
    );
  }
}