4

enter image description here

I am currently developing a joomla module. For detailed settings i have created two fieldsets - as you can see in my screenshot. Is there any way to sort the fieldsets to bring "chart data" and "chart options" tab to 2nd and 3rd place? Order should be Module, chart data, chart options, ...

the actual code is simple:

<config>
    <fields name="params">
        <fieldset name="MOD_NX_CHARTS_DATA_LABEL">

I have already checked joomla's dev guides but i did not find any informations if that is possible or not...

Someone any suggestions if / how this could be possible?

Thanks for any help

1 Answer 1

2

It is technically possible to achieve, but modules aren't really designed with that in mind, so you'd have to override a com_modules view. Personally, I think you have to have strong reason to change default Joomla behaviour as it can make patching the site more complex down the line.

Anyway....

The tab order is defined in administrator\components\com_modules\views\module\tmpl\edit.php, in the following bit of code

        <?php if (isset($long_description) && $long_description != '') : ?>
            <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'description', JText::_('JGLOBAL_FIELDSET_DESCRIPTION')); ?>
            <?php echo $long_description; ?>
            <?php echo JHtml::_('bootstrap.endTab'); ?>
        <?php endif; ?>

        <?php if ($this->item->client_id == 0) : ?>
            <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'assignment', JText::_('COM_MODULES_MENU_ASSIGNMENT')); ?>
            <?php echo $this->loadTemplate('assignment'); ?>
            <?php echo JHtml::_('bootstrap.endTab'); ?>
        <?php endif; ?>

        <?php if ($this->canDo->get('core.admin')) : ?>
            <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'permissions', JText::_('COM_MODULES_FIELDSET_RULES')); ?>
            <?php echo $this->form->getInput('rules'); ?>
            <?php echo JHtml::_('bootstrap.endTab'); ?>
        <?php endif; ?>

        <?php
        $this->fieldsets = array();
        $this->ignore_fieldsets = array('basic', 'description');
        echo JLayoutHelper::render('joomla.edit.params', $this);
        ?>

The first three sections of code creates the default tabs, before the following code adds any additional bespoke tabs:

        <?php
        $this->fieldsets = array();
        $this->ignore_fieldsets = array('basic', 'description');
        echo JLayoutHelper::render('joomla.edit.params', $this);
        ?>

It does this by calling the layout at layouts\joomla\edit\params.php, which generates a tab with echo JHtml::_('bootstrap.addTab', 'myTab', 'attrib-' . $name, $label); for each fieldset.

If you copy the edit.php file to your admin template, eg administrator/templates/isis/html/com_modules/module/edit.php (if you are using isis), then you can switch that order around, or write additional logic to treat specific modules differently.

As I say, I think it's probably not worth doing unless it gives you a strong usability benefit, as it seems the sort of thing it is easy to forget you've done at patching time.

1
  • Wow ok - thanks! I hoped it would be a little bit easier but in this case, you are right - the benefit is not big enough for this project... but i will have a look into that in the future - thanks for your help!
    – Marco
    Dec 11, 2016 at 20:23

Your Answer

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

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