You are here

entity_share_field_collection.abstract.inc in Entity Share 7

Class for handling Field Collection Import/Export Abstract.

File

modules/entity_share_field_collection/includes/entity_share_field_collection.abstract.inc
View source
<?php

/**
 * @file
 * Class for handling Field Collection Import/Export Abstract.
 */

/**
 * Abstract class for Field Collection import/export management.
 */
abstract class EntityShareFieldCollectionAbstract {

  /**
   * Data of the field.
   *
   * @var array
   *   Data of the field.
   */
  protected $fieldData;

  /**
   * Field name.
   *
   * @var string
   *   Machine name of the field.
   */
  protected $fieldName;

  /**
   * Field type.
   *
   * @var string
   *   Type of the field.
   */
  protected $fieldType;

  /**
   * Entity object.
   *
   * @var object
   *   Entity.
   */
  protected $entity;

  /**
   * Field metadatas.
   *
   * @var array
   *   Field info.
   */
  protected $fieldInfo;

  /**
   * Language of the current data.
   *
   * @var string
   *   Language.
   */
  protected $fieldLang;

  /**
   * Delta of the field.
   *
   * @var int
   *   Delta of the field (0, 1 etc).
   */
  protected $delta;

  /**
   * Entity share object.
   *
   * @var EntityShareEntityAbstract
   *   EntityShareEntity object.
   */
  protected $entityShareEntity;

  /**
   * Types managed by the class.
   *
   * @var array
   *   Type of field types managed.
   */
  protected $managedFieldTypes = array(
    'field_collection',
  );

  /**
   * Current field entity type.
   *
   * @var string
   *   Entity type of the field.
   */
  protected $fieldEntityType = 'field_collection_item';

  /**
   * Constructor. Initialize properties.
   *
   * @param array $field_data
   *   Datas of the field.
   * @param string $field_name
   *   Name of the field.
   * @param string $field_type
   *   Type of the field.
   * @param object $entity
   *   Current entity to import or export.
   * @param array $field_info
   *   Info of the field.
   * @param string $lang
   *   Language of the field.
   * @param int $delta
   *   Delta of the field.
   * @param EntityShareEntityAbstract $entity_share_entity
   *   The EntityShareEntityAbstract object.
   */
  public function __construct(array &$field_data, $field_name, $field_type, $entity, array $field_info, $lang, $delta, EntityShareEntityAbstract $entity_share_entity) {
    $this->fieldData =& $field_data;
    $this->fieldName = $field_name;
    $this->fieldType = $field_type;
    $this->entity = $entity;
    $this->fieldInfo = $field_info;
    $this->fieldLang = $lang;
    $this->fieldDelta = $delta;
    $this->entityShareEntity = $entity_share_entity;
  }

  /**
   * Check if the field type is managed.
   *
   * @return bool
   *   TRUE if the current module can handle the field type, FALSE otherwise.
   */
  public function isManagedFieldType() {
    return in_array($this->fieldType, $this->managedFieldTypes);
  }

}

Classes

Namesort descending Description
EntityShareFieldCollectionAbstract Abstract class for Field Collection import/export management.