diff --git a/filefield_paths.module b/filefield_paths.module index 732b140..85d4e77 100644 --- a/filefield_paths.module +++ b/filefield_paths.module @@ -339,6 +339,10 @@ function filefield_paths_entity_insert(EntityInterface $entity) { /** * Implements hook_entity_update(). + * + * There's a temporary override mechanism in case we want to disable / change + * filefield paths' settings for a specific entity. Just set the settings to + * override in $field->filefield_paths_settings */ function filefield_paths_entity_update(EntityInterface $entity) { if (!$entity instanceof ContentEntityInterface) { @@ -348,6 +352,12 @@ function filefield_paths_entity_update(EntityInterface $entity) { foreach ($entity->getFields() as $field) { if (FieldItem::hasConfigurationEnabled($field)) { $settings = FieldItem::getConfiguration($field); + + // Check for temporary settings overrides in this field. + if (!($field->getValue()[0]['filefield_paths_settings']['enabled'] ?? TRUE)) { + continue; + } + // Invoke hook_filefield_paths_process_file(). $module_handler->invokeAll( 'filefield_paths_process_file',