You are here

public function CRMFeedsActivityProcessor::getMappingTargets in CRM Core 7

Same name and namespace in other branches
  1. 8.3 modules/crm_core_activity/legacy/CRMFeedsActivityProcessor.inc \CRMFeedsActivityProcessor::getMappingTargets()
  2. 8 modules/crm_core_activity/legacy/CRMFeedsActivityProcessor.inc \CRMFeedsActivityProcessor::getMappingTargets()
  3. 8.2 modules/crm_core_activity/legacy/CRMFeedsActivityProcessor.inc \CRMFeedsActivityProcessor::getMappingTargets()

Return available mapping targets.

File

modules/crm_core_activity/includes/CRMFeedsActivityProcessor.inc, line 217
Class definition of CRMFeedsActivityProcessor.

Class

CRMFeedsActivityProcessor
Creates activities from feed items.

Code

public function getMappingTargets() {
  $types = crm_core_activity_types();
  $type = $types[$this->config['activity_type']];
  $targets = parent::getMappingTargets();
  $targets += array(
    'title' => array(
      'name' => t('Title'),
      'description' => t('The title of the CRM Core Activity.'),
      'optional_unique' => TRUE,
    ),
    'activity_id' => array(
      'name' => t('Activity ID'),
      'description' => t('The activity_id of the activity. NOTE: use this feature with care, activity ids are usually assigned by Drupal.'),
      'optional_unique' => TRUE,
    ),
    'uid' => array(
      'name' => t('User ID'),
      'description' => t('The Drupal user ID of the activity author.'),
    ),
    'created' => array(
      'name' => t('Created date'),
      'description' => t('The UNIX time when a activity has been created.'),
    ),
  );

  // If the target content type is a Feed activity, expose its source field.
  if ($id = feeds_get_importer_id($this->config['activity_type'])) {
    $name = feeds_importer($id)->config['name'];
    $targets['feeds_source'] = array(
      'name' => t('Feed source'),
      'description' => t('The activity type created by this processor is a Feed Node, it represents a source itself. Depending on the fetcher selected on the importer "@importer", this field is expected to be for example a URL or a path to a file.', array(
        '@importer' => $name,
      )),
      'optional_unique' => TRUE,
    );
  }

  // Let other modules expose mapping targets.
  self::loadMappers();
  feeds_alter('feeds_processor_targets', $targets, 'crm_core_activity', $this->config['activity_type']);
  $this
    ->getHookTargets($targets);
  return $targets;
}