---
title: "WT Layout select - free Joomla plugin for selecting the layout file - WebTolk websites development, Joomla Extensions"
description: "Joomla Custom field plugin: dropdown with PHP layout files from configured folders, including active template overrides. Free Joomla plugin download."
url: "https://web-tolk.ru/en/dev/joomla-plugins/wt-layout-select-joomla-custom-field-plugin"
date: "2026-06-10T07:40:09+00:00"
language: "en-GB"
---

# WT Layout select - plugin for selecting the layout file

- **Category:** [Joomla plugins](https://web-tolk.ru/en/dev/joomla-plugins)
- **Version:** 1.0.1
- **Date:** 26 February 2026

891 734 CTR 121% Plg Free

[Download](https://web-tolk.ru/en/get?element=wtlayoutselect)[Versions](https://web-tolk.ru/en/dev/joomla-plugins/wt-layout-select-joomla-custom-field-plugin/versions)

Joomla Custom field plugin: dropdown with PHP layout files from configured folders, including active template overrides.

## Description

The plugin adds a custom field type `wtlayoutselect`.

Joomla field capabilities:

- scans configured folders with PHP layouts;
- shows available options in a dropdown, including template overrides (`/templates/<template>/html/...`);
- saves the selected value into field `rawvalue` with `layout` and `basePath` (JSON);
- provides computed value in `value` (`layout_id`) that can be used with Joomla `LayoutHelper::render()`.

## Why use it?

 Demo video of switching block layouts in Joomla articles from the admin panel

This field is useful when you want to let a content manager choose a layout variant without editing template PHP files:

- articles (`com_content`): article sections, cards, CTA blocks;
- contacts (`com_contact`): different contact card templates;
- categories and lists: different partial layouts for different contexts;
- module output zones: include content/modules in the required layout variant.
- ability to create reusable layout blocks for Joomla landing pages.

## 2 main ways to use the field

You use this field in your overrides for Joomla article/contact layouts or other components that support custom fields. To avoid automatic field output on the page, it is recommended to disable that in field settings. The field acts as a logical layout switch, and its output (`$field->value`) is primarily intended for developers.

### Option 1: render by computed `$field->value`

```
<?php
use Joomla\CMS\Layout\LayoutHelper;

$field = $this->item->jcfields[14] ?? null;

if ($field && !empty($field->value)) {
    echo LayoutHelper::render($field->value, ['item' => $this->item]);
}
```

Or a variant of the same code with access by name (alias) of the field:

```
<?php
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Layout\LayoutHelper;

// Rebuild custom fields by field alias
$customFields = [];
foreach ($this->item->jcfields as $f) {
    $customFields[$f->name] = $f;
}

echo LayoutHelper::render(layoutFile: $customFields['layout-select']->value, displayData: ['item' => $this->item, 'jcfields' => $customFields]);
```

### Option 2: render from `rawvalue` with `basePath`

```
<?php
use Joomla\CMS\Layout\LayoutHelper;

$field = $this->item->jcfields[14] ?? null;

if ($field && !empty($field->rawvalue)) {
    $raw = json_decode($field->rawvalue);

    if (!empty($raw->layout) && !empty($raw->basePath)) {
        echo LayoutHelper::render($raw->layout, ['item' => $this->item], $raw->basePath);
    }
}
```

## How to set folders in field params and what computed `layout_id` you get

Examples below are for field `wtlayoutselect` with selected file `pricelist.php`.

| Folder in field params | Where file is located | `rawvalue` (key part) | Computed `layout_id` in `$field->value` |
| --- | --- | --- | --- |
| `layouts/com_content/article/sections` | `JPATH_ROOT/layouts/com_content/article/sections/pricelist.php` | `basePath=layouts/com_content/article/sections`, `layout=pricelist` | `com_content.article.sections.pricelist` |
| `layouts/com_content/article/sections` | `templates/<template>/html/com_content/article/sections/pricelist.php` (override) | `basePath=layouts/com_content/article/sections`, `layout=pricelist` | `com_content.article.sections.pricelist` |
| `templates/multizone/html/com_content/article/sections` | `JPATH_ROOT/templates/multizone/html/com_content/article/sections/pricelist.php` | `basePath=templates/multizone/html/com_content/article/sections`, `layout=pricelist` | `templates.multizone.html.com_content.article.sections.pricelist` |
| `components/com_contact/layouts/contact/parts` | `JPATH_ROOT/components/com_contact/layouts/contact/parts/pricelist.php` | `basePath=components/com_contact/layouts/contact/parts`, `layout=pricelist` | `components.com_contact.layouts.contact.parts.pricelist` |

Important:

- For paths starting with `layouts/...`, the plugin removes `layouts.` prefix in `$field->value` so `layout_id` can be passed directly to `LayoutHelper`.
- For paths outside `JPATH_ROOT/layouts` (for example, `templates/...`, `components/...`), `layout_id` includes full path in dot format.
- In such cases, rendering via `rawvalue` with explicit `basePath` (option 2 above) is usually more reliable.

Example call in article override (`/templates/<template>/html/com_content/article/default.php`):

```
<?php
use Joomla\CMS\Layout\LayoutHelper;

$field = null;

foreach (($this->item->jcfields ?? []) as $f) {
    if (($f->name ?? '') === 'article_layout_variant') {
        $field = $f;
        break;
    }
}

if ($field && !empty($field->value)) {
    echo LayoutHelper::render($field->value, ['item' => $this->item]);
}
```

## Layout examples: when `item` is passed from article context

Below are layout file examples (for instance in `layouts/com_content/article/sections/...`) when you pass `['item' => $this->item]`.

### Example 1: basic article section layout

File: `layouts/com_content/article/sections/lead.php`

```
<?php
/** @var array $displayData */

defined('_JEXEC') or die;

extract($displayData);

if (empty($item)) {
    return;
}
?>
<section class="article-lead">
    <h2><?php echo htmlspecialchars($item->title ?? '', ENT_QUOTES, 'UTF-8'); ?></h2>

    <?php if (!empty($item->images)) :
        $images = json_decode($item->images);
        $intro  = $images->image_intro ?? '';
    ?>
        <?php if (!empty($intro)) : ?>
            <img src="/<?php echo htmlspecialchars($intro, ENT_QUOTES, 'UTF-8'); ?>" alt="">
        <?php endif; ?>
    <?php endif; ?>

    <div>
        <?php echo $item->introtext ?? ''; ?>
    </div>
</section>
```

### Example 2: getting article custom fields inside layout

File: `layouts/com_content/article/sections/specs.php`

```
<?php
/** @var array $displayData */

defined('_JEXEC') or die;

extract($displayData);

if (empty($item)) {
    return;
}

$fields = $item->jcfields ?? [];
$sku    = null;
$price  = null;

foreach ($fields as $f) {
    if (($f->name ?? '') === 'sku') {
        $sku = $f->rawvalue;
    }

    if (($f->name ?? '') === 'price') {
        $price = $f->rawvalue;
    }
}
?>
<div class="product-specs">
    <?php if (!empty($sku)) : ?><p>SKU: <?php echo htmlspecialchars($sku, ENT_QUOTES, 'UTF-8'); ?></p><?php endif; ?>
    <?php if (!empty($price)) : ?><p>Price: <?php echo htmlspecialchars($price, ENT_QUOTES, 'UTF-8'); ?></p><?php endif; ?>
</div>
```

## Rendering custom module position via ModuleHelper in Joomla overrides

File: `layouts/com_content/article/sections/sidebar-modules.php`

```
<?php
/** @var array $displayData */

defined('_JEXEC') or die;

use Joomla\CMS\Helper\ModuleHelper;

extract($displayData);

// Optionally choose position by article/category
$position = 'article-sidebar';

$modules = ModuleHelper::getModules($position);

if (empty($modules)) {
    return;
}
?>
<aside class="article-sidebar-modules">
    <?php
        // Render all modules from this position
        foreach ($modules as $module) : ?>
        <div class="article-sidebar-module">
            <?php echo ModuleHelper::renderModule($module, ['style' => 'none']); ?>
        </div>
    <?php endforeach; ?>
</aside>
```

## Joomla

 **Extension type:** Plugin **Folder:** Fields **Joomla version:** 6.0.3

## Gallery

![...](https://web-tolk.ru/en/dev/joomla-plugins/images/swjprojects/projects/111/en-GB/gallery/Avk8O5ob2Du.jpg)

![...](https://web-tolk.ru/en/dev/joomla-plugins/images/swjprojects/projects/111/en-GB/gallery/8RnLhzxMkEE.webp)

![...](https://web-tolk.ru/en/dev/joomla-plugins/images/swjprojects/projects/111/en-GB/gallery/0YtghxAG2cn.webp)

## What's new

 2026-02-26 12:43:31

Addition

### Default option in select list

Added a plug-in option by default for the drop-down list.

## JSON-LD Schema

```json
{
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "@id": "https://web-tolk.ru/#/schema/BreadcrumbList/17",
    "itemListElement": [
        {
            "@type": "ListItem",
            "position": 1,
            "item": {
                "@id": "https://web-tolk.ru/en",
                "name": "Home"
            }
        },
        {
            "@type": "ListItem",
            "position": 2,
            "item": {
                "@id": "https://web-tolk.ru/en/dev",
                "name": "Joomla extensions"
            }
        },
        {
            "@type": "ListItem",
            "position": 3,
            "item": {
                "@id": "/en/dev/joomla-plugins",
                "name": "Joomla plugins"
            }
        },
        {
            "@type": "ListItem",
            "position": 4,
            "item": {
                "name": "WT Layout select - plugin for selecting the layout file"
            }
        }
    ]
}
```

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Organization",
            "@id": "https://web-tolk.ru/#/schema/Organization/base",
            "name": "WebTolk",
            "url": "https://web-tolk.ru/",
            "logo": {
                "@type": "ImageObject",
                "@id": "https://web-tolk.ru/#/schema/ImageObject/logo",
                "url": "images/webtolk-1080p.jpg",
                "contentUrl": "images/webtolk-1080p.jpg",
                "width": 1920,
                "height": 1080
            },
            "image": {
                "@id": "https://web-tolk.ru/#/schema/ImageObject/logo"
            },
            "sameAs": [
                "https://github.com/WebTolk",
                "https://github.com/sergeytolkachyov",
                "https://vk.com/web_tolk",
                "https://vk.com/webtolkru",
                "https://tenchat.ru/sergeytolkachyov",
                "https://t.me/sergeytolkachyov",
                "https://t.me/webtolkru"
            ]
        },
        {
            "@type": "WebSite",
            "@id": "https://web-tolk.ru/#/schema/WebSite/base",
            "url": "https://web-tolk.ru/",
            "name": "WebTolk websites development, Joomla Extensions",
            "publisher": {
                "@id": "https://web-tolk.ru/#/schema/Organization/base"
            }
        },
        {
            "@type": "WebPage",
            "@id": "https://web-tolk.ru/#/schema/WebPage/base",
            "url": "https://web-tolk.ru/en/dev/joomla-plugins/wt-layout-select-joomla-custom-field-plugin",
            "name": "WT Layout select - free Joomla plugin for selecting the layout file - WebTolk websites development, Joomla Extensions",
            "description": "Joomla Custom field plugin: dropdown with PHP layout files from configured folders, including active template overrides. Free Joomla plugin download.",
            "isPartOf": {
                "@id": "https://web-tolk.ru/#/schema/WebSite/base"
            },
            "about": {
                "@id": "https://web-tolk.ru/#/schema/SoftwareApplication/base"
            },
            "inLanguage": "en-GB",
            "breadcrumb": {
                "@id": "https://web-tolk.ru/#/schema/BreadcrumbList/17"
            }
        },
        {
            "@type": "SoftwareApplication",
            "name": "WT Layout select - plugin for selecting the layout file",
            "url": "https://web-tolk.ru/en/dev/joomla-plugins/wt-layout-select-joomla-custom-field-plugin",
            "description": "Joomla Custom field plugin: dropdown with PHP layout files from configured folders, including active template overrides.",
            "applicationCategory": "Joomla plugins",
            "softwareVersion": "1.0.1",
            "downloadUrl": "https://web-tolk.ru/en/get?element=wtlayoutselect",
            "operatingSystem": "ANY",
            "interactionStatistic": [
                {
                    "@type": "InteractionCounter",
                    "interactionType": "https://schema.org/DownloadAction",
                    "userInteractionCount": 891
                },
                {
                    "@type": "InteractionCounter",
                    "interactionType": "https://schema.org/ViewAction",
                    "userInteractionCount": 735
                }
            ],
            "mainEntityOfPage": {
                "@type": "WebPage",
                "url": "https://web-tolk.ru/en/dev/joomla-plugins/wt-layout-select-joomla-custom-field-plugin"
            },
            "softwareRequirements": "Joomla",
            "applicationSubCategory": "1.0.1",
            "isAccessibleForFree": true,
            "keywords": [
                "joomla",
                " plugin",
                " download",
                " free"
            ]
        }
    ]
}
```
