Search
Other Tabs & Accordions questions
Forum

Field tags not expanded in a specific situation

Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
Hey Peter,

A colleague is using a simple module that I created, displaying OpenStreetMap maps using LeafletJS. The markers are rendered using article data. Article texts are displayed in a popup when a marker is clicked.

My colleague uses your Tabs & Accordions extension in the article content. Those tabs also containf {field ##} tags. The articles show up perfectly fine when displayed in the normal way, as a single article view for instance. However, in a marker popup the tabs are rendered including any static text within them, but the fields are not. Not even the field tags are displayed, which suggests they are parsed bot not correctly replaced with the field contents.

Do you have any idea what might go wrong here?
Peter van Westen's Avatar Peter van Westen ADMIN
Do you have this online so I can take a look?
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
Unfortunately not. It is on my local dev system.
Peter van Westen's Avatar Peter van Westen ADMIN
Reading your message again, as far as I understand:
You have marker popups. Tabs & Accordions is working fine there. But the {field} tags are not.
So this has nothing to do with Tabs & Accordions.

So if I understand correctly, you are asking me to debug a Joomla issue. That is not something that this forum is for or what I am willing to do.

The Joomla {field} plugin is a content plugin and is (therefor) pretty limited.
You could try outputting the fields through Articles Anywhere instead.
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
Stupid me. I didn't think of {field} to be core Joomla! but as part of the Tabs & Accordions syntax. Sorry.

It did put me on the right track though. I found out that the core Fields content plugin checks for a text property on the object being checked for {field} tags. It was missing from my logic. After adding it, {field} tags are now properly expanded.

This leaves me with one problem to solve. Clicking non active tabs does not activate them. I assume this is because no event handlers are added yet, because the content of the popups is not available yet when the page is rendered. Is there a way to add those when the popup is displayed?
Peter van Westen's Avatar Peter van Westen ADMIN
Not sure. There is a chance that the necessary scripts cannot get loaded because the content is dynamically loaded in via ajax.

If you can reproduce this on an online environment, I am happy to look into this.
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
I managed to solve it, by calling RegularLabs.TabsAccordions.init(null) the first time a popup is displayed.

Thanx for your time.
Peter van Westen's Avatar Peter van Westen ADMIN
Awesome!
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
For these kind of circumstances it would be helpful if the init() could be invoked on a specific DOM element instead of always on all existing on a page. Maybe something like:
RegularLabs.TabsAccordions = {
  init: function(settings, selector = '[data-rlta-element="container"]') {
    document.querySelectorAll(selector).forEach(container => {
        container.rlta = new Set(container, settings);
    });
  },
  
  ...
  ...
  ...
};
Peter van Westen's Avatar Peter van Westen ADMIN
Invoking the init will simply handle all tabs/accordions sets that haven't been initialized yet. So no need for an element selection.
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
If only uninitialized tabs/accordions are processed, that is good enough. Passing a specific selector would then fall in the category micro optimization 🙂
Peter van Westen's Avatar Peter van Westen ADMIN
Yup (sorry, misread the first time).
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription