API

You can get template parameters according to Joomla! API, but because of the peculiarities of storing parameter data, it is not always convenient and often problematic.

The template offers a number of additional features, designed as a template Configurator and already available in the template layouts, to facilitate obtaining a number of parameters.


The connection of the Configurator

JLoader::register('Master3Config', JPATH_LIBRARIES . '/master3/config.php');
$config = \Master3Config::getInstance();

When overriding the basic template layouts, you do not need to connect the Configurator – it is already connected in index.php template.


Properties

$name: string

Template name.


$isMain: bool

Is main page.


$isWebP: bool

Indicates whether the user's browser supports webp image format.


$params: \Joomla\Registry\Registry

Template parameters in the form in which they are stored Joomla!.


Functions used in an overridden layout template

getBodyClasses(): string

Get the string of the classes for <body>.

Applies only to index.php template.


getLayout(): string

Get the name of the assigned file layout for the current page.

Applies only to index.php template.


getSystemOutput(): string

Getting the main content render (component render).

Return value: an html markup string or an empty string if the content of the main content render is not available, or if the render is not allowed by the Do not display the component on the page template parameter.


getLogo(): string

Get a render of the logo position, if it has published modules, or the logo specified in the template parameters.

Return value: a string with html markup.


getSectionParams((string)$sectionName,(int)$sectionType=0): \stdClass

Get settings section.

Input vars:
$sectionName – section name
$sectionType – section type:
0 - standard,
1 - section with parameters for sidebars,
2 - section with parameters for navbar

Return value: standard class, field list:

  • (string)id – section ID
  • (string)class – section class
  • (string)image – background image
  • (string)style – style of module positions inside the section
  • (string)container – content container class within a section
  • (string)responsive – the suffix for the css class .uk-child-width - * for grid blocks of module positions inside a section
  • (string)gridClass – class grid of blocks of module positions inside the section

(the following parameters are only for the section with parameters for sidebars)

  • (string)mainGridSize – the dimension for the css class .uk-width-* for the unit core content of the website
  • (string)sidebarGridSize – the dimension for the css class .uk-width-* for the sidebar blocks
  • (string)sidebarAClass – sidebar A block class
  • (string)sidebarBClass – sidebar B block class

(the following parameters are only for the section with parameters for navbar)

  • (string)sticky – html attribute to apply sticky
  • (string)navbarMode – parameter string for the html attribute data-uk-navbar
  • (bool)dropbarMode – the flag option is used Dropbar mode
  • (string)nbLeftDisplay – display class of position block navbar-left for adaptation
  • (string)nbCenterDisplay – display class of position block navbar-center for adaptation
  • (string)nbRightDisplay – display class of position block navbar-right for adaptation

getOffcanvasParams((string)$offcanvasName): \stdClass

Get settings offcanvas-section.

Input vars:
$offcanvasName – name offcanvas-section

Return value: standard class, field list:

  • (int)id – section ID
  • (string)class – section class
  • (string)attrs – parameter string of the data-uk-offcanvas attribute for the section

Functions used in the formation of the styles of the modules

getModuleParams((int)$moduleId): \stdClass

Get the parameters of the module set in the template by its ID.

Input vars:
$moduleId – module ID

Return value: standard class, field list:

  • (int)id – module ID
  • (string)class – module class
  • (string)dataAttrs – data-attrs of module block
  • (string)display – a class that determines whether the module block is displayed depending on the width of the browser workspace or the device screen
  • (string)align – a class that defines content alignment in a module block
  • (bool)offtoggle – flag available only for modules of type mod_menu, which determines whether to show the mobile menu open button
  • (string)titleTag – the html header tag or module string, if the value of this parameter should be taken from the module parameters
  • (string)titleClass – module title class
  • (string)titleLink – link for moddule title

getOffcanvasToggle(): string

Returns the css class suffix .uk-visible*, .uk-hidden*.

The value is set by the Offcanvas toggle template parameter.


Functions used in templates extension, it's overridden in the base template

getMenuItemParams((int)$itemId): \stdClass

Get the parameters of a particular menu item set in the template by its ID.

Area of use: mod_menu, module template navbar.

Input vars:
$itemId – menu item ID

Return value: standard class, field list:

  • (int)id – menu item ID
  • (string)subtitle – subtitle
  • (int)cols – number of columns in the submenu
  • (bool)divider – the divider for the columns in the submenu
  • (bool)dropdownJustify – the alignment of the submenu block across the width of the navbar container
  • (string)dropdownClass – additional block class of the submenu of the top-level menu item

getDUA(): string

Get the value of the Deny user authorization template parameter.

Area of use: com_users, mod_login.


Static functions

getInstance(): \Master3Config

Get an instance of the Configurator. The function gets an already created instance of the Configurator or calls the Configurator constructor if the Configurator is called for the first time within a PHP session. Directly the constructor of the Configurator might not be called.


getTemplateName(): string

Get template name.

This function is used only for the service needs of the Configurator and is not recommended for use.