2

Can somebody explain what is the purpose of metadata.xml in components files? For example /components/com_content/metadata.xml

As it almost has no content and I've never seen this in use.

1

1 Answer 1

3

So the purpose of metadata.xml is storing the data that need to be shared across layouts:

each layout.xml inside of your view tmpl directory extends metadata.xml.


So if you need to put some request fields in each layout - you can simply add this fields to metadata.xml and all the layouts will inherit them.

For example file /site/view/examples/metadata.xml can look like this

<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <view>
        <options var="additional_request_var">
            <default name="COM_EXAMPLE" msg="COM_EXAMPLE_DESC"/>
            <option name="COM_EXAMPLE_EXT" msg="COM_EXAMPLE_EXT_DESC" value="additional_request_var_value" />
        </options>
    </view>
</metadata>

More at https://github.com/joomplace/JooYii

2
  • Can you please share an example of metadata.xml and a layout xml where layout XML extends metadata.xml ? I did a dozen of tries and metadata.xml seem to be ignored. I need a correct metadata.xml structure. Thank you! Aug 6, 2016 at 12:15
  • Done. contact me if you have some questions.
    – Alexandr
    Jan 8, 2017 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.