PHP Joomla! 6 Joomla! 5 Joomla! 3 (Legacy) Template Override Basic

Use Raw Value (rawvalue) vs Formatted Value (value) in Custom Fields

Uses rawvalue for conditionals, URLs and data attributes while keeping value for human-readable formatted output.

Updated on 24 November 2026 34 copies 134 views
templates/seu_template/html/com_content/article/default.php
<?php

declare(strict_types=1);

use Joomla\CMS\HTML\HTMLHelper;

// Campo tipo List: rawvalue = chave ('em-andamento'), value = rótulo ('Em andamento')
$statusKey   = (string) ($fieldsByName['status']->rawvalue ?? '');
$statusLabel = (string) ($fieldsByName['status']->value ?? '');

// Campo tipo Media (Joomla 5/6): rawvalue é JSON com imagefile e alt_text
$mediaData = json_decode((string) ($fieldsByName['capa']->rawvalue ?? '{}'), true);
$imageUrl  = !empty($mediaData['imagefile']) ? HTMLHelper::cleanImageURL($mediaData['imagefile'])->url : '';
Media fields store JSON in rawvalue in Joomla 5 and 6; decode to read imagefile.
templates/seu_template/html/com_content/article/default.php
<?php
$statusKey   = $field->rawvalue;
$statusLabel = $field->value;
Classic rawvalue and value usage in Joomla 3.7+.

Technical explanation and best practices

For list, calendar, URL or media fields, $field->value contains rendered HTML or labels, while $field->rawvalue holds the underlying value (option key, ISO date or JSON media payload).

Direct Engineering

Have a Joomla project or technical challenge in mind?

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