You are here

function hook_fieldmap_objects in Salesforce Suite 7

Same name and namespace in other branches
  1. 6.2 hooks.php \hook_fieldmap_objects()
  2. 7.2 salesforce_api.api.php \hook_fieldmap_objects()

Expose fields to fieldmappings.

Salesforce_api does not expose any Drupal fields. It's up to modules (e.g. sf_user and sf_node) to make those fields available for mapping. Developers implementing this hook should pay close attention to the import/export functions for each field, which are responsible for delivering the actual data for mapped fields. If import or export indexes are unset, salesforce_api will use the property of the object with the same fieldname. For example, "nid" does not have an import/export function, because "nid" is a property of the $node object.


$object_type: Where does the data come from? Either "drupal" or "salesforce".

Return value

The function should return an associative array of entities, each describing its bundles and the fields that should be made available for mapping. Each field is an associative array with the following keys (optional unless noted):

  • 'label' (required): The translated, user-friendly name of this field
  • 'type': Relevant for Salesforce fields only. Use one of the following constants

  • 'import': callback function to import this field.
  • 'export': callback function to export this field.
  • 'multiple': Is this a multiple-valued field in Salesforce? (ie. ;-delimited)
  • 'group': Assign the field to a grouping on the field mapping UI
2 functions implement hook_fieldmap_objects()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

salesforce_api_fieldmap_objects in salesforce_api/salesforce_api.module
Implements hook_fieldmap_objects().
sf_entity_fieldmap_objects in sf_entity/sf_entity.module
Implements hook_fieldmap_objects_alter().
1 invocation of hook_fieldmap_objects()
salesforce_api_fieldmap_objects_load in salesforce_api/salesforce_api.module
Returns all or a subset of the objects defined via hook_sf_fieldmap().


./hooks.php, line 46
These are the hooks that are invoked by the Salesforce core.


function hook_fieldmap_objects($object_type) {
  if ($type == 'drupal') {
    return array(
      // "node" is the entity
      'node' => array(
        // "page" is the bundle
        'page' => array(
          'label' => t('Page node'),
          'fields' => array(
            'nid' => array(
              'label' => t('Node ID'),
              'type' => SALESFORCE_FIELD_SOURCE_ONLY,
            'type' => array(
              'label' => t('Node type'),
            'status' => array(
              'label' => t('Is the node published?'),
            'field_sample_checkbox' => array(
              'label' => t('Widget Label'),
              'group' => t('CCK fields'),
              'export' => '_sf_node_export_cck_default',
              'import' => '_sf_node_import_cck_default',
              'multiple' => TRUE,