public function OpignoTincanPackageItemList::postSave in Opigno module 8
Same name and namespace in other branches
- 3.x ActivityTypes/opigno_tincan_activity/src/Plugin/Field/FieldType/OpignoTincanPackageItemList.php \Drupal\opigno_tincan_activity\Plugin\Field\FieldType\OpignoTincanPackageItemList::postSave()
Defines custom post-save behavior for field values.
This method is called during the process of saving an entity, just after item values are written into storage.
Parameters
bool $update: Specifies whether the entity is being updated or created.
Return value
bool Whether field items should be rewritten to the storage as a consequence of the logic implemented by the custom behavior.
Overrides FileFieldItemList::postSave
See also
\Drupal\Core\Field\FieldItemInterface::postSave()
File
- ActivityTypes/
opigno_tincan_activity/ src/ Plugin/ Field/ FieldType/ OpignoTincanPackageItemList.php, line 15
Class
- OpignoTincanPackageItemList
- Represents a configurable entity file field.
Namespace
Drupal\opigno_tincan_activity\Plugin\Field\FieldTypeCode
public function postSave($update) {
parent::postSave($update);
$tincan_content_service = \Drupal::service('opigno_tincan_activity.tincan');
// Extract tincan per each archive.
foreach ($this
->referencedEntities() as $file) {
if (!$update) {
$tincan_content_service
->saveTincanPackageInfo($file);
}
else {
$package_info = $tincan_content_service
->getInfoFromExtractedPackage($file);
if ($package_info === FALSE) {
$tincan_content_service
->saveTincanPackageInfo($file);
}
}
}
}