Skip to content

Conversation

@chrissonntag
Copy link
Contributor

Make allowed file extensions configurable for all file processors

Description

This pull request addresses the issue #337 "Feature Request: Make allowed file extensions configurable". By introducing configurable allowed file extensions, users can now customize which file extensions each processor handles without modifying source code.
The previous defined, hardcoded file extensions serve as default values, but can now be customized to the user's extend.

Changes

Fluid Processor

  • Created FluidProcessorOption with ALLOWED_FILE_EXTENSIONS constant
  • Implemented FluidFormatConfiguration class
  • Updated FluidFileProcessor to read from configuration
  • Added to application configuration

TypoScript Processor

  • Added ALLOWED_FILE_EXTENSIONS constant to TypoScriptProcessorOption
  • Updated TypoScriptPrettyPrinterFormatConfiguration to accept and manage allowed file extensions
  • Modified TypoScriptFileProcessor to use strict comparison and read from configuration

Yaml Processor

  • Created YamlProcessorOption with ALLOWED_FILE_EXTENSIONS constant
  • Implemented YamlFormatConfiguration class for managing allowed extensions
  • Updated YamlFileProcessor to use the new configuration class
  • Modified application configuration to inject the format configuration

Xml Processor

  • Added ALLOWED_FILE_EXTENSIONS constant to XmlProcessorOption
  • Created XmlFormatConfiguration class
  • Updated XmlFileProcessor to use configuration and strict comparison
  • Integrated into application configuration

Commits

  1. [FEATURE] Introduce FluidFormatConfiguration and update FluidFileProcessor - Adds configuration for Fluid processor
  2. [FEATURE] Add XmlFormatConfiguration and integrate into XmlFileProcessor - Adds configuration for Xml processor
  3. [FEATURE] Implement YamlFormatConfiguration and integrate into YamlFileProcessor - Adds configuration for Yaml processor
  4. [FEATURE] Enhance TypoScript configuration options - Adds configuration for TypoScript processor

Verification

To verify the changes:

  1. Run composer local:contribute to ensure all code quality checks pass
  2. Test configuration by setting allowed file extensions via Fractor parameters
  3. Confirm processors now respect configured extensions instead of hardcoded ones

Example

A simplified example configuration regarding the new configuration options might look like the following:

use a9f\Fractor\Configuration\FractorConfiguration;
use a9f\FractorFluid\Configuration\FluidProcessorOption;
use a9f\FractorTypoScript\Configuration\TypoScriptProcessorOption;
use a9f\FractorXml\Configuration\XmlProcessorOption;
use a9f\FractorYaml\Configuration\YamlProcessorOption;

return FractorConfiguration::configure()
    ->withOptions([
        FluidProcessorOption::ALLOWED_FILE_EXTENSIONS => ['html'],
        TypoScriptProcessorOption::ALLOWED_FILE_EXTENSIONS => ['typoscript', 'tsconfig', 'tss', 'tsc'],
        XmlProcessorOption::ALLOWED_FILE_EXTENSIONS => ['xml', 'xlf'],
        YamlProcessorOption::ALLOWED_FILE_EXTENSIONS => ['yaml', 'yml'],
    ]);

@chrissonntag
Copy link
Contributor Author

I've implemented Unit Tests for the 4 FileProcessors to validate either the default or custom configuration of allowed file extension work accordingly.

@simonschaufi
Copy link
Collaborator

Just 4yi: I'm focusing first on the tasks that are relevant for my budget as promised an will then take care about all the other things.

@chrissonntag
Copy link
Contributor Author

It's totally fine, I fully understand. No need to rush. We've created a Fractor-Extension with those adjustments, ready to be superceded by the main project once it's there.

@simonschaufi
Copy link
Collaborator

If you want to get some feedback, you can also reach out to Andreas on Slack or here.

Copy link
Collaborator

@simonschaufi simonschaufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is missing is the documentation part in the readme.

@simonschaufi simonschaufi force-pushed the feature/configure-allowed-file-extensions branch from 95f7889 to bd79a9c Compare January 3, 2026 14:19
@simonschaufi simonschaufi force-pushed the feature/configure-allowed-file-extensions branch from bd79a9c to 8df7cea Compare January 3, 2026 14:27
…ions

📝 Added a section on configuring allowed file extensions for different processors.
🔧 Provided default extensions for Fluid, TypoScript, XML, and YAML file types.
@chrissonntag
Copy link
Contributor Author

What is missing is the documentation part in the readme.

I've added the section in 849b1e4

@chrissonntag
Copy link
Contributor Author

Please let me know if there is anything else missing or to be done.

@simonschaufi simonschaufi merged commit bcd09a2 into andreaswolf:main Jan 3, 2026
36 checks passed
@simonschaufi
Copy link
Collaborator

Thank you very much for your contribution!

@chrissonntag
Copy link
Contributor Author

Very much welcomed 😁

@chrissonntag chrissonntag deleted the feature/configure-allowed-file-extensions branch January 4, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants