public function CRMFeedsContactProcessor::getMappingTargets in CRM Core 8
Same name and namespace in other branches
- 8.3 modules/crm_core_contact/legacy/CRMFeedsContactProcessor.inc \CRMFeedsContactProcessor::getMappingTargets()
- 8.2 modules/crm_core_contact/legacy/CRMFeedsContactProcessor.inc \CRMFeedsContactProcessor::getMappingTargets()
- 7 modules/crm_core_contact/includes/CRMFeedsContactProcessor.inc \CRMFeedsContactProcessor::getMappingTargets()
Return available mapping targets.
File
- modules/
crm_core_contact/ legacy/ CRMFeedsContactProcessor.inc, line 225 - Class definition of CRMFeedsContactProcessor.
Class
- CRMFeedsContactProcessor
- Creates contacts from feed items.
Code
public function getMappingTargets() {
$types = ContactType::loadMultiple();
$type = $types[$this->config['contact_type']];
$targets = parent::getMappingTargets();
$targets += [
'contact_id' => [
'name' => t('Contact ID'),
'description' => t('The contact_id of the contact. NOTE: use this feature with care, contact ids are usually assigned by Drupal.'),
'optional_unique' => TRUE,
],
'uid' => [
'name' => t('User ID'),
'description' => t('The Drupal user ID of the contact author.'),
],
'created' => [
'name' => t('Created date'),
'description' => t('The UNIX time when a contact has been created.'),
],
];
// If the target content type is a Feed contact, expose its source field.
if ($id = feeds_get_importer_id($this->config['contact_type'])) {
$name = feeds_importer($id)->config['name'];
$targets['feeds_source'] = [
'name' => t('Feed source'),
'description' => t('The contact 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.', [
'@importer' => $name,
]),
'optional_unique' => TRUE,
];
}
// Let other modules expose mapping targets.
self::loadMappers();
feeds_alter('feeds_processor_targets', $targets, 'crm_core_contact', $this->config['contact_type']);
return $targets;
}