function filefield_paths_entity_update in File (Field) Paths 8
Implements hook_entity_update().
2 calls to filefield_paths_entity_update()
- filefield_paths_entity_insert in ./
filefield_paths.module - Implements hook_entity_insert().
- _filefield_paths_batch_update_process in ./
filefield_paths.module - Batch callback for File (Field) Paths retroactive updates.
File
- ./
filefield_paths.module, line 348 - Contains core functions for the File (Field) Paths module.
Code
function filefield_paths_entity_update(EntityInterface $entity) {
if ($entity instanceof ContentEntityInterface) {
foreach ($entity
->getFields() as $field) {
if ($field instanceof FileFieldItemList) {
/** @var FieldConfig $definition */
$definition = $field
->getFieldDefinition();
// Ignore base fields.
if ($definition instanceof ThirdPartySettingsInterface) {
$settings = $definition
->getThirdPartySettings('filefield_paths');
if (isset($settings['enabled']) && $settings['enabled']) {
// Invoke hook_filefield_paths_process_file().
foreach (\Drupal::moduleHandler()
->getImplementations('filefield_paths_process_file') as $module) {
if (function_exists($function = "{$module}_filefield_paths_process_file")) {
$function($entity, $field, $settings);
}
}
}
}
}
}
}
}