function salesforce_mapping_ui_entity_extra_field_info in Salesforce Suite 5.0.x
Same name and namespace in other branches
- 8.4 modules/salesforce_mapping_ui/salesforce_mapping_ui.module \salesforce_mapping_ui_entity_extra_field_info()
Implements hook_entity_extra_field_info().
File
- modules/
salesforce_mapping_ui/ salesforce_mapping_ui.module, line 96 - Manages Salesforce object and Drupal entity mappings.
Code
function salesforce_mapping_ui_entity_extra_field_info() {
// Include Salesforce data for mapped entities.
// @TODO: these don't actually show up on the entity view. Have to implement hook_entity_view as well?
$extra = [];
$mappings = \Drupal::service('entity_type.manager')
->getStorage('salesforce_mapping')
->loadPushMappings();
foreach ($mappings as $mapping) {
$extra[$mapping->drupal_entity_type][$mapping->drupal_bundle] = [
'display' => [
'salesforce_id' => [
'label' => t('Salesforce Id'),
'description' => t('ID of a linked Salesforce object.'),
'weight' => 0,
],
'salesforce_last_sync' => [
'label' => t('Salesforce last sync'),
'description' => t('Timestamp for the latest sync with Salesforce.'),
'weight' => 0,
],
],
];
}
return $extra;
}