/redaxo-mform:mform-outputfrom redaxo-mform
Reads MForm field values in REDAXO module OUTPUT PHP. Normalizes link data, repeater JSON, and resolves redaxo:// URLs to actual hrefs for frontend templates.
Ships in redaxo-mform. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Written for MForm ≥ 9.0.0 (the version this plugin requires). Items marked (v9+) do not exist in MForm 8.x. Runtime check:
rex_version::compare(rex_addon::get('mform')->getVersion(), '9.0.0', '>=').
The MFormOutputHelper class (namespace FriendsOfRedaxo\MForm\Utils) normalises all link and repeater values for use in frontend templates.
Unified entry point that accepts any link format and returns a consistent array.
use FriendsOfRedaxo\MForm\Utils\MFormOutputHelper;
$data = MFormOutputHelper::createLinkData('REX_VALUE[1]');
| Input | Example |
|---|---|
| Internal article (redaxo:// prefix) | redaxo://12 |
| Internal article (plain numeric ID) | 14 |
| Media filename | image.jpg |
| External URL | https://example.com |
mailto:[email protected] | |
| Telephone | tel:+49123456789 |
Already-prepared array with customlink_url | passed through as-is |
Repeater array with id / name keys | ['id' => 'redaxo://12', 'name' => 'Artikel [12]'] |
[
'customlink_url' => 'https://example.com', // resolved URL ready for href=
'customlink_text' => 'Example', // display text (article name / media title / URL)
'customlink_target' => ' target="_blank" rel="noopener noreferrer"', // for external links
'customlink_class' => 'external', // 'internal' | 'external' | 'media' | 'mail' | 'tel'
'type' => 'external', // 'internal' | 'external' | 'media' | 'email' | 'telephone'
'article_id' => null, // int if internal link
'clang_id' => null, // int if internal link
'filename' => null, // string if media
'extension' => null, // file extension if media
'protocol' => 'https', // scheme for external
'domain' => 'example.com',
'metadata' => [], // article / media metadata
]
$data = MFormOutputHelper::createLinkData('REX_VALUE[1]', [
'extern_blank' => false, // default true – don't add target="_blank" for external
'mode' => 'raw', // 'frontend' (default) | 'raw' | 'strict'
]);
use FriendsOfRedaxo\MForm\Utils\MFormOutputHelper;
$data = MFormOutputHelper::createLinkData('REX_VALUE[1]');
if ('' !== $data['customlink_url']) {
echo '<a href="' . rex_escape($data['customlink_url']) . '"'
. $data['customlink_target'] . '>'
. rex_escape($data['customlink_text'])
. '</a>';
}
When you just need the resolved URL without metadata:
$url = MFormOutputHelper::getCustomLinkUrl('REX_VALUE[1]');
// or from an already-prepared array:
$url = MFormOutputHelper::getCustomLinkUrl($linkData);
Use MFormRepeaterHelper::decode() (v9+) – it handles JSON decoding, HTML entity decoding, and filters disabled rows (online/offline toggle) in one call.
See the mform-flex-repeater skill for the full Repeater API including
filterByField(),sortByField(),groupByField(), andlimitItems().
use FriendsOfRedaxo\MForm\Repeater\MFormRepeaterHelper;
$rows = MFormRepeaterHelper::decode('REX_VALUE[1]');
// Alternative for an already-decoded array (plain json_decode works on any version; prepareItemsForOutput() itself needs MForm ≥ 9):
// $raw = json_decode(html_entity_decode('REX_VALUE[1]', ENT_QUOTES | ENT_HTML5, 'UTF-8'), true) ?? [];
// $rows = MFormRepeaterHelper::prepareItemsForOutput($raw);
use FriendsOfRedaxo\MForm\Utils\MFormOutputHelper;
// Adds <field>_normalized key alongside the original
$items = MFormOutputHelper::normalizeRepeaterItems($items, ['link', 'cta']);
foreach ($items as $item) {
$link = $item['link_normalized'];
echo '<a href="' . rex_escape($link['customlink_url']) . '">'
. rex_escape($link['customlink_text']) . '</a>';
}
// Replace original field (no _normalized suffix)
$items = MFormOutputHelper::normalizeRepeaterItems($items, ['link'], ['replace' => true]);
use FriendsOfRedaxo\MForm\Repeater\MFormRepeaterHelper;
use FriendsOfRedaxo\MForm\Utils\MFormOutputHelper;
$rows = MFormRepeaterHelper::decode('REX_VALUE[1]');
$rows = MFormOutputHelper::normalizeRepeaterItems($rows, ['cta_link']);
foreach ($rows as $row) {
$title = rex_escape($row['title'] ?? '');
$text = $row['text'] ?? ''; // may contain HTML from TinyMCE
$filename = $row['image'] ?? '';
$link = $row['cta_link_normalized'];
echo '<div class="card">';
if ($filename) {
echo '<img src="' . rex_url::media($filename) . '" alt="">';
}
echo '<h3>' . $title . '</h3>';
echo '<div>' . $text . '</div>';
if ($link['customlink_url']) {
echo '<a href="' . rex_escape($link['customlink_url']) . '"'
. $link['customlink_target'] . '>'
. rex_escape($link['customlink_text']) . '</a>';
}
echo '</div>';
}
When a media filename is passed, the returned array includes:
$data = MFormOutputHelper::createLinkData('hero.jpg');
// $data['type'] → 'media'
// $data['customlink_url'] → '/media/hero.jpg'
// $data['filename'] → 'hero.jpg'
// $data['extension'] → 'jpg'
// $data['metadata']['title'] → media title from mediapool
// $data['metadata']['width'] → image width
// $data['metadata']['height']→ image height
Check if the current slice is the first slice of an article:
if (MFormOutputHelper::isFirstSlice(REX_SLICE_ID)) {
// render differently for first module instance
}
createLinkData() or normalizeLinkData() instead of manually parsing redaxo:// – the helper resolves article names, media URLs and external link targets in one call.customlink_target is already a ready-to-embed attribute string ( target="_blank" rel="noopener noreferrer") or empty string – just echo it directly, no need to check it.customlink_class is a plain string ('internal', 'external', etc.), not an HTML class attribute string.normalizeRepeaterItems() (v9+) does not mutate the original array – assign the return value.mode = 'raw' keeps backend helper labels (article name with [ID] suffix) in the name key. Use for debugging only.MFormRepeaterHelper::decode('REX_VALUE[n]') – it handles JSON decoding, HTML entity decoding, empty-string values on fresh modules, and filtering of disabled rows in one call. Only fall back to json_decode(html_entity_decode($raw, ENT_QUOTES | ENT_HTML5, 'UTF-8'), true) ?? [] when you're running MForm 9+ but still hold data decoded the old (v8-era) way – then post-process it with MFormRepeaterHelper::prepareItemsForOutput() (both decode() and prepareItemsForOutput() require MForm ≥ 9).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/mform-basicsBuilding REDAXO module inputs with MForm – MForm::factory(), all add*Field() methods (text, textarea, select, radio, checkbox, link, media, hidden, headline, description, alert, html), wrapper elements (fieldset, column, tab, collapse, accordion, modal, inline, conditional), setters (setLabel, setAttributes, setOptions, setSqlOptions, setTooltipInfo, setFull, setSize, setMultiple, setDefaultValue), and how the form is rendered via show(). Use when the user writes or edits module INPUT PHP, uses MForm to build a backend form, or asks how to add a specific field type to a REDAXO module./mform-flex-repeaterDynamic list / repeater fields in REDAXO modules with MForm – addFlexRepeaterElement(), addRepeaterElement(), nested repeaters, supported widget types inside repeaters (custom-link, media, imagelist, medialist, linklist, radio, checkbox, color-swatch, modal), the __MFRID__ placeholder for unique IDs per row, reading repeater values in OUTPUT PHP with rex_var_custom_medialist / json_decode, and the full list of supported vs. unsupported widget types. Use when the user wants a dynamic list of rows in a module input, uses addRepeaterElement or addFlexRepeaterElement, or asks how to add an image gallery / team list / FAQ with variable rows to a REDAXO module./mform-widgetsAdvanced MForm widget fields – Custom-Link (addCustomLinkField, addCustomLinkMultipleField, addMFormLinkField), Media picker (addMediaField, addMFormMediaField), Medialist, Imagelist, Linklist, ColorSwatch (addColorSwatchField). Covers all data-* attributes for controlling which link types are enabled (intern/extern/media/mailto/tel), ylink table links, media type restrictions, preview options, and how each widget stores and returns its value. Use when the user adds a link picker, media picker, image gallery, link list, or color swatch to a REDAXO module or YForm form./mform-yformUsing MForm-provided YForm value types in YForm table definitions and YForm forms – custom_link, custom_link_multi, color_swatch, imagelist, medialist, linklist value types. Covers how to add these fields programmatically (rex_yform_manager_table_api::setTableField) and via tableset JSON, their stored value formats, how to read values via YOrm datasets, and ytemplates used for rendering in the backend. Use when the user adds a custom_link, color_swatch, imagelist, medialist, or linklist field to a YForm table, uses these field types in a YForm form, or asks how to render MForm widget values stored in a YForm database column.npx claudepluginhub friendsofredaxo/claude-marketplace --plugin redaxo-mformOther plugins' skills for the same job