You are here

protected function EntityShareEntityExport::manageField in Entity Share 7

Manage the field.

Parameters

array $field_info: Informations of the current field.

string $field_name: Name of the current field.

object $entity: Entity or sub entity to export.

Overrides EntityShareEntityAbstract::manageField

File

includes/entity_share.entity.export.inc, line 74
Class for handling Entity Export.

Class

EntityShareEntityExport
Manage general entity export.

Code

protected function manageField(array $field_info, $field_name, $entity = NULL) {
  if (!isset($entity)) {
    $entity = $this
      ->getEntity();
  }
  $field_type = $field_info['type'];

  // Loop for multi language.
  foreach ($entity->{$field_name} as $lang => &$datas) {
    foreach ($datas as $delta => &$value) {

      // Hook alter.
      $context = array(
        'field_name' => $field_name,
        'field_type' => $field_type,
        'lang' => $lang,
        'delta' => $delta,
        'entity' => $entity,
        'field_info' => $field_info,
        'entity_share_entity' => $this,
      );
      drupal_alter(self::HOOK_PREFIX . 'field_data', $value, $context);
    }
  }
}