public function EntityShareFieldCollectionImport::importDatas in Entity Share 7
Manage field collection for the import.
File
- modules/
entity_share_field_collection/ includes/ entity_share_field_collection.import.inc, line 19 - Class for handling Field Collection Import.
Class
- EntityShareFieldCollectionImport
- A class to import the field collection.
Code
public function importDatas() {
// Check if the field type is managed by the module.
if (!$this
->isManagedFieldType()) {
return;
}
// Keep some needed data that will be overrided
// by this code to inject them after.
if (isset($this->fieldData['entity_share'])) {
$bck_entity_share = $this->fieldData['entity_share'];
}
// Security to not have invalid field collection entities.
if (!$this
->isValidFieldCollectionEntity()) {
return;
}
// Get the updated fc entity.
$fc_entity = $this
->getUpdatedFieldCollection($this->fieldEntityType);
// Set the entity share property from backup.
if (isset($bck_entity_share)) {
$fc_entity->entity_share = $bck_entity_share;
}
// Attach the field collection to the local entity.
$this->entity->{$this->fieldName}[$this->fieldLang][$this->fieldDelta] = array(
'entity' => $fc_entity,
);
// Recursion on field import of the field collection
// to import file etc.
$this->entityShareEntity
->contentFieldWalk($fc_entity);
}