You are here

function _sf_node_import_body in Salesforce Suite 6.2

Same name and namespace in other branches
  1. 7 sf_entity/sf_entity.module \_sf_node_import_body()
1 string reference to '_sf_node_import_body'
sf_node_fieldmap_objects in sf_node/sf_node.module
Implementation of hook_fieldmap_objects_alter().

File

sf_node/sf_node.module, line 367
Integrates the core node object and various node related modules with the Salesforce API.

Code

function _sf_node_import_body(&$node, $drupal_fieldname, $drupal_field_definition, $sf_data, $sf_fieldname, $sf_field_definition) {

  // Preserve Drupal configuration for this node in terms of whether or not
  // the teaser is included in the body text.
  $import_data = html_entity_decode($sf_data->{$sf_fieldname});
  if (!empty($node->teaser) and strpos($node->body, '<!--break-->') !== 0) {

    // Teaser is included in body.
    $node->body = $import_data;
  }
  else {

    // Teaser is not included in body.
    $offset = strpos($import_data, '<!--break-->');
    $node->body = substr($import_data, $offset);
  }
  $node->teaser = node_teaser($import_data);
}