madeyourday/contao-rocksolid-custom-elements

Feature: Add PHP snippets

jankout opened this issue · 4 comments

I think it would be a great feature to have the possibility of adding some PHP snippets that I would like to use in more config files at the same time.

ausi commented

This is already possible by including configurations from other elements. For example to import fieldA from rsce_element_a as fieldB in rsce_element_b you can use the following code:

'fieldB' => (include __DIR__.'/rsce_element_a_config.php')['fields']['fieldA'],

That's great. But I would like to have a group of code in one PHP file and just add one row of code to add its content into a configuration or html5 file.

ausi commented

I would like to have a group of code in one PHP file and just add one row of code to add its content into a configuration or html5 file.

That is exactly what you can do with the include code from above.

How is it if I want to include all the content of a snippets PHP file? Let's say I will have there 5 DCA fields which I would like to implement in another config file at one time.

If it's possible to do it I think it could be mentioned in your documentation because it can save a lot of time.