You are here

public function EntityShareEntityAbstract::contentFieldWalk in Entity Share 7

Walk though the entity to do special treatment in function of field type.

Parameters

object $entity: Entity or sub entity to share.

2 calls to EntityShareEntityAbstract::contentFieldWalk()
EntityShareEntityExport::contentFieldWalk in includes/entity_share.entity.export.inc
Walk though the entity to load dependencies and prepare it for the export.
EntityShareEntityImport::execute in includes/entity_share.entity.import.inc
Generate the import.
1 method overrides EntityShareEntityAbstract::contentFieldWalk()
EntityShareEntityExport::contentFieldWalk in includes/entity_share.entity.export.inc
Walk though the entity to load dependencies and prepare it for the export.

File

includes/entity_share.entity.abstract.inc, line 140
Class for handling Entity Export Abstract.

Class

EntityShareEntityAbstract
Entity Share Entity class.

Code

public function contentFieldWalk($entity = NULL) {
  if (!isset($entity)) {
    $entity = $this
      ->getEntity();
  }

  // Fix some exceptions or warnings linked to the json conversion.
  if (isset($entity->translations) && !is_object($entity->translations)) {
    $entity->translations = (object) $entity->translations;
  }

  // Load additional needed information.
  foreach ($entity as $field_name => $field_value) {
    if (in_array($field_name, $this->internalFields)) {
      continue;
    }

    // Needed to detect that a field is a collection field.
    $field_info = field_info_field($field_name);
    if (!isset($field_info['type'])) {
      continue;
    }
    $this
      ->manageField($field_info, $field_name, $entity);
  }
}