webguys-de / EasyTemplate

42 stars 13 forks source link

Feature-Request: allow to deactivate templates and fields via XML #47

Closed gfobe closed 7 years ago

gfobe commented 7 years ago

If you arrange the template for a customer (e.g. add responsive stuff) it would be great if you are able to disable templates and single fields in templates via easytemplate.xml with <enabled>0</enabled> like you do this with whole groups. At the moment you have to disable the old group, define a new one without the templates or fields and check on every update if fields were changed.

tobi-pb commented 7 years ago

So we have to add an enabled tag to group-tag?

gfobe commented 7 years ago

Give me some minutes. I will send a PullRequest supporting <templates><foo><enabled>0</enabled> and <fields><bar><enabled>0</enabled>. The groups are the only one enable work at the moment.

tobi-pb commented 7 years ago

Merged. Thanks a lot

gfobe commented 7 years ago

Sample what is possible in an own easytemplate.xml now:

<config>
    <easytemplate>
        <simple>
            <templates>
                <text_picture>
                    <fields>
                        <!-- add field to define if image should be shown in left or right column -->
                        <image_column translate="label,comment">
                            <label>Column of image</label>
                            <comment>In which column the picture should be shown?</comment>
                            <backend_model>easytemplate/template_data_varchar</backend_model>
                            <input_renderer>easytemplate/input_renderer_select</input_renderer>
                            <input_renderer_source>easytemplate/input_renderer_source_values</input_renderer_source>
                            <values>
                                <left>Left</left>
                                <right>Right</right>
                            </values>
                            <sort_order>15</sort_order>
                            <default_value>left</default_value>
                            <required>1</required>
                        </image_column>

                        <!-- justify comment -->
                        <image_alignment>
                            <comment>How to align the image within the column</comment>
                        </image_alignment>
                    </fields>
                </text_picture>

                <!-- remove field width because it should be 100% always -->
                <google_maps>
                    <fields>
                        <width>
                             <enabled>0</enabled>
                        </width>
                    </fields>
                </google_maps>

                <!-- disable template 2column -->
                <text_2column>
                    <enabled>0</enabled>
                </text_2column>
            </templates>
        </simple>

        <!-- disable group product -->
        <product>
            <enabled>0</enabled>
        </product>
    </easytemplate>
</config>