Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DataContainerConfigOptionToParameterRector #10

Closed
wants to merge 6 commits into from

Conversation

zoglo
Copy link
Member

@zoglo zoglo commented May 8, 2024

Description

Old:

'screenshot' => [
    'exclude' => true,
    'inputType' => 'fileTree',
    'eval' => ['fieldType'=>'radio', 'filesOnly'=>true, 'isGallery'=>true, 'extensions'=>Contao\Config::get('validImageTypes')],
    'sql' => "binary(16) NULL"
],

New:

'screenshot' => [
    'exclude' => true,
    'inputType' => 'fileTree',
    'eval' => ['fieldType'=>'radio', 'filesOnly'=>true, 'isGallery'=>true, 'extensions'=>'%contao.image.valid_extensions%'],
    'sql' => "binary(16) NULL"
],

Test

image

@aschempp
Copy link
Member

aschempp commented May 8, 2024

I'm not sure this is correct. We can only replace the config option with a parameter where it is expected to work, e.g. in the DCA config. If my custom code retrieves this value, we cannot replace this with a string, it would break everything?

@zoglo
Copy link
Member Author

zoglo commented May 9, 2024

Same as #8 (comment) - Might need to limit it to specific arrays and entry types (array keys) to change the value.

@zoglo zoglo changed the title Add ConfigOptionToParameterRector Add DataContainerConfigOptionToParameterRector Aug 9, 2024
@zoglo
Copy link
Member Author

zoglo commented Aug 9, 2024

@aschempp This one is even more specific now and checks if it's in an array with key an eval, then checks the extensions and whether the static call is the Contao\Config::class with method get to replace it

image

Could do the same for #6 if we want it even more specific as well 🤔

@zoglo
Copy link
Member Author

zoglo commented Aug 12, 2024

Will be implemented in #6

@zoglo zoglo closed this Aug 12, 2024
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