You are here

function salesforce_mapping_entity_extra_field_info in Salesforce Suite 8.3

Implements hook_entity_extra_field_info().

File

modules/salesforce_mapping/salesforce_mapping.module, line 61
Manages Salesforce object and Drupal entity mappings.

Code

function salesforce_mapping_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.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;
}