You are here

protected function EntityShareEntityImport::manageField in Entity Share 7

Manage the field.

Parameters

array $field_info: Metadata of the field.

string $field_name: Name of the field.

object $entity: Entity or sub entity to import.

Overrides EntityShareEntityAbstract::manageField

File

includes/entity_share.entity.import.inc, line 163
Class for handling Entity Import.

Class

EntityShareEntityImport
Manage general entity import.

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 after.
      $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);
    }
  }
}