T
T
Tatyana Egorova2019-04-07 10:23:27
Joomla
Tatyana Egorova, 2019-04-07 10:23:27

How to add a section or tab in Joomla 3x module admin panel?

I have a custom module in Joomla. Everything works, but you need to make three sections for three elements in the admin panel. I don’t understand how to write in the code so that each group of parameters has its own name, as in the picture, what is written in red. 5ca9a5687136c974266218.jpeg
helper.php

<?php

// No direct access
defined( '_JEXEC' ) or die;

/**
 * Class Module Helper
 * @author Татьяна Егорова
 */
class modConditionHelper
{

  /**
   * getData method
   * @param $params
   * @return array
   */
  static function getData( $params )
  {
    $db = JFactory::getDbo();
    return array();
  }

}

mod_condition.php
<?php

// No direct access
defined( '_JEXEC' ) or die;

require_once( dirname( __FILE__ ) . '/helper.php' );
$data = modConditionHelper::getData( $params );
$moduleclass_sfx = htmlspecialchars( $params->get( 'moduleclass_sfx' ) );
require( JModuleHelper::getLayoutPath( 'mod_condition', $params->get( 'layout', 'default') ) );

mod_condition.xml
<?xml version="1.0"?>
<extension type="module" version="1.0.0" method="upgrade" client="site">
    <name>MODULE_CONDITION</name>
    <author>Татьяна Егорова</author>
    <authorEmail>[email protected]</authorEmail>
    <authorUrl>http://egorova-prog.ru</authorUrl>
    <copyright></copyright>
    <license></license>
    <version>1.0</version>
    <description>MOD_CONDITION_DESC</description>
    <files>
        <filename module="mod_condition">mod_condition.php</filename>
        <filename>index.html</filename>
        <filename>helper.php</filename>
        <folder>tmpl</folder>
    </files>
  <languages>
    <language tag="en-GB">language/en-GB.mod_condition.ini</language>
    <language tag="en-GB">language/en-GB.mod_condition.sys.ini</language>
    <language tag="ru-RU">language/ru-RU.mod_condition.ini</language>
    <language tag="ru-RU">language/ru-RU.mod_condition.sys.ini</language>
  </languages>
    <config>
        <fields name="params">
            <fieldset name="basic" label="Опция 1">
        <field 
            name="param1"
            type="imagelist"
            label="MOD_CONDITION_PARAM1"
            required="true"
            default=""
            directory="images"
            exclude="\.html$"
            stripext="true">
        </field>
        <field 
            name="param2"
            type="text"
            label="MOD_CONDITION_PARAM2"
            required="true"
            default=""
            size="10"
            class=""
            readonly="false"
            disabled="false"
            filter="">
        </field>
        <field 
            name="param3"
            type="text"
            label="MOD_CONDITION_PARAM3"
            required="true"
            default=""
            size="10"
            class=""
            readonly="false"
            disabled="false"
            filter="">
        </field>
            </fieldset>
            <fieldset name="advanced">
                <field name="layout" type="modulelayout" label="JFIELD_ALT_LAYOUT_LABEL"
                       description="JFIELD_ALT_MODULE_LAYOUT_DESC"/>
                <field name="moduleclass_sfx" type="text" label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
                       description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"/>
                <field name="cache" type="list" label="COM_MODULES_FIELD_CACHING_LABEL"
                       description="COM_MODULES_FIELD_CACHING_DESC" default="1">
                    <option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
                    <option value="1">JGLOBAL_USE_GLOBAL</option>
                </field>
            </fieldset>
        </fields>
    </config>
</extension>

tmpl/default.php
<?php
// No direct access
defined( '_JEXEC' ) or die;
?>
<div class="module<?php echo $moduleclass_sfx; ?>">
    <div style="text-align: center;"><img src="images/<?php echo $params->get( 'param1' ); ?>.png" alt="" /><br />
    <p style="font-family: Lato, sans-serif; font-weight: bold; font-style: normal; font-size: 18px; margin: 30px 0px 18px; text-transform: uppercase;">
        <?php echo $params->get('param2'); ?>
    </p>
    <p style="font-family: Lato, sans-serif; font-weight: bold; font-style: normal; font-size: 18px; margin: 30px 0px 18px; text-transform: uppercase;">
        <span style="color: #444444; font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; text-transform: none; text-align: center;">
            <?php echo $params->get('param3'); ?>
        </span>
    </p>
</div>
</div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question