Technical Library / Open Source

Joomla Snippets

Searchable collection of production-ready code recipes for template overrides, modules, plugins, and Joomla! 3 to 6 APIs.

100 Snippets
12 Categories
J3 to J6 Compatibility
Showing 7 of 7 snippets
PHP J6 J5 J3 Plugin
Parameters and Extensions

Read Plugin Parameters Inside the Plugin

Reads XML configuration fields inside a CMSPlugin subclass using $this->params->get() with a safe fallback.

<?php

declare(strict_types=1);

// Dentro de uma classe que estende Joomla\CMS\Plugin\CMSPlugin
$param = (string) $this->params->get('paramName', 'defaultValue');
24 111 2 versions
PHP J6 J5 J3 Helper / API
Parameters and Extensions

Read Plugin Parameters Outside the Plugin

Fetches and parses the JSON parameters of any published plugin from a module, component or template.

<?php

declare(strict_types=1);

use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Registry\Registry;

// ...
39 166 2 versions
PHP J6 J5 J3 Module
Parameters and Extensions

Read Module Parameters Inside the Module

Reads module XML configuration values inside the module Dispatcher or tmpl layout files.

<?php

declare(strict_types=1);

// Dentro de tmpl/default.php ou override do módulo
/** @var \Joomla\Registry\Registry $params */
$param = (string) $params->get('paramName', 'defaultValue');
21 103 2 versions
PHP J6 J5 J3 Helper / API
Parameters and Extensions

Read Module Parameters Outside the Module

Loads a published module instance by name (and optional title) and parses its Registry parameters.

<?php

declare(strict_types=1);

use Joomla\CMS\Helper\ModuleHelper;
use Joomla\Registry\Registry;

// ...
31 135 2 versions
PHP J6 J5 J3 Component
Parameters and Extensions

Read Component Parameters Inside the Component

Retrieves active component parameters merged with current menu item overrides using $app->getParams().

<?php

declare(strict_types=1);

use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Factory;

// ...
27 120 2 versions
PHP J6 J5 J3 Helper / API
Parameters and Extensions

Read Any Component Parameters Externally

Reads global options of any component from plugins, modules, CLI scripts or other components using ComponentHelper::getParams().

<?php

declare(strict_types=1);

use Joomla\CMS\Component\ComponentHelper;

$componentParams = ComponentHelper::getParams('com_example');
// ...
29 127 2 versions
PHP J6 J5 J3 Plugin
Parameters and Extensions

Check if a Content Plugin Is Enabled and Read Its Options

Checks whether a specific content plugin is published before safely reading its Registry parameters.

<?php

declare(strict_types=1);

use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Registry\Registry;

// ...
20 98 2 versions
Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.