1

For our latest Joomla-Projects, I extended the com_content component with custom fields using the following documentation:

https://docs.joomla.org/Adding_custom_fields_to_core_components_using_a_plugin

However, I did not use params as field name, but attributes, like this:

<?xml version="1.0" encoding="UTF-8"?>
<form>
    <fields name="attribs" >
        <fieldset name="site1" label="Client Name">
            <field name.....

In the template, I can access these fields with ease:

$attr = json_decode($article->attribs);

Everything is working fine so far.

But, this method has one big downside. If I use other plugins/components for instance, galleries, that require shortcode inside the editor (such as: {gallery id="2"}), which gets replaced by the actual gallery when loading the page, it does not work.

The page simply shows the shortcode {gallery id="2"}, as the gallery content plugin does not parse the custom field (no plugin does...)

How can I enable the parsing by content-plugins for these fields?

1

1 Answer 1

1

Have you tried to echo the attrbs content through the JHTML content.prepare?

e.g.:

$attrbs = json_decode($this->item->attribs);

echo JHtml::_('content.prepare',$attrbs->myfield);
0

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.