AddOn
MBlock Multiple-Blöcke in Modul-Input-Formularen
Beschreibung
MBlock - multiple Datenblöcke innerhalb eines Moduls anlegen und sortieren.Mit MBlock ist es möglich innerhalb eines Moduls belieb viele Datenblöcke zu erzeugen. Die Datenblöcke können dann einfach per Drag & Drop oder auch via Up-/Down-Button sortiert werden.
Die aktuellste MBlock Version auf Github: https://github.com/FriendsOfREDAXO/mblock
Umsetzung
Versionen
4.6.6
Checkbox-Werte bleiben rückwärtskompatibel: Beim Reindexing wurden Checkbox-Values clientseitig auf 1/0 normalisiert. Dadurch gingen benutzerdefinierte Werte wie checked verloren und bestehende Modul-Logik konnte brechen. MBlock erhält nun den ursprünglichen Basiswert pro Checkbox und überschreibt nur noch echte boolesche Werte kontrolliert.
4.6.5
Version 4.6.5 - 2026-06-24
Bug Fixes
- Media-Popup mit langer Widget-ID wieder korrekt: In der MBlock-Bridge und beim Reinitialisieren der REDAXO-Widgets wurde die
REX_MEDIA_*-ID bisher auf reine Ziffern gekürzt. Bei IDs wieREX_MEDIA_1GBS...führte das zu falschemopener_input_field=REX_MEDIA_1. Der vollständige ID-Suffix wird jetzt erhalten und anopenREXMedia/viewREXMedia/addREXMedia/deleteREXMediaweitergegeben. - Nur erstes MBlock-Element wurde gespeichert: Beim Initial-Render konnten mehrere Blöcke denselben Feldnamen-Index
[0]behalten. Dadurch kollidierten POST-Keys und spätere Elemente wurden überschrieben. Beim erstenmblock_init()wird jetzt ein zusätzlichermblock_reindex()ausgeführt, sodass Namen sofort korrekt auf[0],[1], ... verteilt sind.
4.6.4
Version 4.6.4 - 2026-06-16
Bug Fixes
- CKEditor-5-Sync beim Submit stabilisiert: In mblock_sync_all_cke5_to_textareas wurde eine fehlerhafte const-Neuzuweisung im DOM-Fallback behoben (TypeError: invalid assignment to const).
4.6.3
What's Changed
- Fix für MBlock-Popup-ID-Auflösung bei Link, Media, Linklist und Medialist in dynamischen Blöcken by @thorol in https://github.com/FriendsOfREDAXO/mblock/pull/228
New Contributors
- @thorol made their first contribution in https://github.com/FriendsOfREDAXO/mblock/pull/228
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.6.2...4.6.3
4.6.2
Version 4.6.2 - 2026-05-30
Bug Fixes
- Warnings bei MForm custom/core Toggle behoben: Die Replacer-Logik für
REX_MEDIALIST_SELECT_*undREX_LINKLIST_SELECT_*ersetzt den Name-Identifier jetzt null-sicher. Dadurch treten keine PHP-Deprecations mehr auf (str_replace(): Passing null to parameter #1) wennsystemIdin einzelnen Widget-HTML-Varianten noch nicht gesetzt ist. - Settings-Serialisierung gehärtet:
MBlockSettingsHelpernormalisiert Array-Werte vor dem Rendern derdata-*-Attribute. Dadurch wird die WarnungArray to string conversionvermieden.
4.6.1
- rex_select mit optgroup verursacht TypeError: In den Select-Replacern werden innerhalb von
optgroupjetzt nur noch echteoption-Elemente verarbeitet. Whitespace-Textknoten (DOMText) werden ignoriert, dadurch tritt der CrashArgument #2 ($option) must be of type DOMElement, DOMText givennicht mehr auf. Siehe Issue #227, gemeldet von @tbaddade. - Defektes Link-Beispiel repariert: Die Beispiel-Datei
base2_link_example.inienthielt beschädigte/duplizierte Startzeilen und ungültigen PHP-Code. Das Beispiel ist wieder lauffähig.
4.6.0
🚨 Bitte unbedingt bei Verwendung von MForm 9 Updatehinweise beachten kurz
MForm::useCustomLinkForClassicWidgets(true);
Erzeugt die Kompatibilität zu MForm 9
Beispiel:
/ useCustomLinkForClassicWidgets(true) sorgt dafür, dass addMediaField / addLinkField
// über das custom_link-Widget gerendert werden → kein Reindex-Problem beim Klonen.
// Das Speicherformat (REX_MEDIA_1 / REX_LINK_n) bleibt identisch.
MForm::useCustomLinkForClassicWidgets(true);
$mform = MForm::factory()
->addFieldsetArea('Team-Mitglied', MForm::factory()
Version 4.6.0 - 2026-05-07
Bug Fixes
- MForm 9 Widgets in MBlock sauber reindexiert:
custom_link,custom_medialist,custom_linklistundimglistwerden nach Add/Sort jetzt mit ihren aktuellen Widget-IDs, Popup-Callbacks und internen Referenzen neu initialisiert. Dadurch funktionieren Picker nach dem Verschieben und in neu angelegten Blöcken zuverlässig weiter. - Neue MBlocks starten mit leeren MForm-Widgets: Beim Klonen eines neuen Blocks werden MForm-Widgetzustände jetzt gezielt zurückgesetzt. Betroffen sind
custom_linksowie diemform-list-widget-Familie (medialist,linklist,imglist). Sichtbare Texte, Hidden-Values, Select-Optionen und gerenderte Listen werden nicht mehr aus dem Quellblock übernommen.
Rückwärtskompatibilität
- Kein Datenbank- oder Content-Break: Bestehende MBlock-Module, gespeicherte Inhalte und Datenstrukturen bleiben unverändert kompatibel.
- Kein harter Addon-Conflict erforderlich: MBlock selbst bleibt zu älteren MForm-Versionen lauffähig. Die Fixes in 4.5.9 fokussieren auf
custom_linkund diemform-list-widget-Familie.
4.5.8
SourceMap-Fehler (404) auf Live-Servern: Der sourceMappingURL-Kommentar in der mblock.min.js wurde entfernt, um 404-Fehler in den Browser-Entwicklertools auf Live-Servern zu vermeiden, die keine .map Dateien ausliefern. Die Map-Datei bleibt weiterhin für Entwicklungszwecke in den Sourcen erhalten. @olien
ℹ️ Mai 2026: Das AddOn befindet sich im Maintenance-Status ab 4.5.7 werden keine neuen Features mehr entwickelt.
4.5.7
Bug Fixes
- REX_LINK – 3. Block überschreibt Link von Block 2:
mblock_update_rex_idshatREX_LINK_-Inputs beim Reindexieren nicht berücksichtigt, sodass alle neuen Blöcke dieselbe Link-ID aus dem Template behielten. Link-Popup-Callbacks schrieben dadurch stets in Block 2.REX_LINK_wird nun korrekt mit dem Block-Index reindexiert. - REX_LINK –
_NAME-Input nach Reindexierung nicht auffindbar (null is not an object evaluating getElementById("REX_LINK_X_NAME")): Der textuelle Anzeigefeld-Input (_NAME) bekam beim generischen Durchlauf einen andereneindexals der hidden-Input → ID-Mismatch._NAME-Inputs werden jetzt im generischen Loop übersprungen und synchron zum hidden-Input mit derselben ID-Basis aktualisiert. deleteREXLinknach Drag & Drop kaputt: Das generische Regex-Replace inmblock_update_rex_buttonshat beideleteREXLink('X')die schließende Quote entfernt → ungültiges JavaScript. -Handler werden jetzt per spezifischem Pattern korrekt mit Quotes ersetzt.- REX_LINK Buttons in Modulen ohne
rex-js-widget-link-Klasse nicht aktualisiert:closest('.rex-js-widget-link')schlug bei HTML-basierten Link-Feldern ohne diese Klasse fehl. Die Widget-Suche verwendet jetzt eine Fallback-Kette (.input-group,.rex-js-widget), die auch bei eigenen Templates greift.
4.5.6
Version 4.5.6 - 2026-02-24
Bug Fixes
- Radio-Button (Copy & Paste) – Wert nicht übernommen: Alle Radio-Inputs einer Gruppe teilen denselben
name-Attribut. Bisher wurde derformData-Eintrag bei jeder Iteration überschrieben, sodass immer das letzte (nicht ausgewählte) Radio gewann. Die Erfassung speichert jetzt pro Gruppe nur den tatsächlich gewählten Wert als neuenradio_group-Typ. - Radio-Button (Copy & Paste) –
active-Klasse als Fallback: MForm Bild-Radios und Color-Radios markieren die aktive Option zusätzlich mitclass="active"am<label>. Diese Klasse wird nun beim Erfassen als Fallback ausgewertet, fallsprop('checked')im DOM-Klon nicht gesetzt ist. - Radio-Button (Copy & Paste) – Tab-Panel-Reset: Nach dem Einfügen triggert mblock
rex:ready, wodurch Tab-Panel- und MForm-Initialisierungen alleactive-Klassen auf Labels zurücksetzen. Die Radio-Wiederherstellung wird deshalb zweistufig durchgeführt: einmal direkt beim Einfügen und nochmals nach demrex:ready/trigger('change')-Zyklus über die neuerestoreRadioGroups()-Methode.
4.5.5
Fehlerbehebungen
- CKEditor 5-Füllinhalt: Automatische Bereinigung von Ersatzinhalten für CKEditor 5 (
<p><br data-cke-filler="true"></p>) und Platzhaltern (<p class="ck-placeholder" ...>) bei der Formularübermittlung hinzugefügt. Dadurch wird verhindert, dass leere Blöcke mit unsichtbaren HTML-Artefakten gespeichert werden.
Cleanup Script for Existing Data
Use the following PHP script Example:
<?php
/**
* MBlock CKEditor 5 Filler Cleanup Script
*
* Run this script in the REDAXO PHP Console (System > Console) or via CLI
* to remove existing filler content from your database.
*/
$tables = [
'rex_article_slice' => 20, // Check value1 - value20
// Add custom YForm tables here if needed:
// 'rex_my_table' => ['description', 'text_column'],
];
$filler1 = '<p><br data-cke-filler="true"></p>';
$filler2 = '<br data-cke-filler="true">';
// JSON escaped variants (often found in MBlock data)
$filler1_json = '<p><br data-cke-filler=\"true\"><\/p>';
$filler2_json = '<br data-cke-filler=\"true\">';
echo "<h2>Cleaning CKEditor 5 Filler Content...</h2>";
foreach ($tables as $table => $columns) {
if (is_int($columns)) {
// Generate value1...valueN for slices
$cols = [];
for ($i = 1; $i <= $columns; $i++) {
$cols[] = 'value' . $i;
}
} else {
$cols = (array) $columns;
}
$sql = rex_sql::factory();
foreach ($cols as $col) {
// 1. Standard HTML replacement
$query = "UPDATE `$table` SET `$col` = REPLACE(`$col`, :filler1, '') WHERE `$col` LIKE :search1";
$sql->setQuery($query, ['filler1' => $filler1, 'search1' => '%data-cke-filler%']);
if ($sql->getRows() > 0) echo "Updated $table.$col (HTML Variant 1): " . $sql->getRows() . " rows<br>";
$query = "UPDATE `$table` SET `$col` = REPLACE(`$col`, :filler2, '') WHERE `$col` LIKE :search2";
$sql->setQuery($query, ['filler2' => $filler2, 'search2' => '%data-cke-filler%']);
if ($sql->getRows() > 0) echo "Updated $table.$col (HTML Variant 2): " . $sql->getRows() . " rows<br>";
// 2. JSON Escaped replacement (common in mblock)
$query = "UPDATE `$table` SET `$col` = REPLACE(`$col`, :filler1, '') WHERE `$col` LIKE :search1";
$sql->setQuery($query, ['filler1' => $filler1_json, 'search1' => '%data-cke-filler%']);
if ($sql->getRows() > 0) echo "Updated $table.$col (JSON Variant 1): " . $sql->getRows() . " rows<br>";
$query = "UPDATE `$table` SET `$col` = REPLACE(`$col`, :filler2, '') WHERE `$col` LIKE :search2";
$sql->setQuery($query, ['filler2' => $filler2_json, 'search2' => '%data-cke-filler%']);
if ($sql->getRows() > 0) echo "Updated $table.$col (JSON Variant 2): " . $sql->getRows() . " rows<br>";
// 3. Regex Replacement for Placeholders (PHP-based because SQL lacks REGEX replace)
// Matches: <p class="ck-placeholder" data-placeholder="..."></p>
$fetchQuery = "SELECT id, `$col` FROM `$table` WHERE `$col` LIKE '%ck-placeholder%'";
// Iterate only over rows that actually match
$iterator = rex_sql::factory()->getArray($fetchQuery);
$localUpdateCount = 0;
foreach ($iterator as $row) {
$original = $row[$col];
$current = $original;
// Regex for HTML variant
$current = preg_replace('/<p class="ck-placeholder" data-placeholder="[^"]+"><\/p>/', '', $current);
// Regex for JSON escaped variant (need to be careful with backslashes)
// Pattern: <p class=\"ck-placeholder\" data-placeholder=\"...\"><\/p>
$current = preg_replace('/<p class=\\\\"ck-placeholder\\\\" data-placeholder=\\\\"[^"]+\\\\"><\\\\\/p>/', '', $current);
if ($current !== $original) {
// Determine ID column name (usually 'id')
$idCol = 'id';
$upd = rex_sql::factory();
$upd->setTable($table);
$upd->setWhere([$idCol => $row[$idCol]]);
$upd->setValue($col, $current);
$upd->update();
$localUpdateCount++;
}
}
if ($localUpdateCount > 0) echo "Updated $table.$col (Placeholders via PHP Regex): " . $localUpdateCount . " rows<br>";
}
}
echo "<br><strong>Cleanup complete!</strong> Clear the cache manually if needed.";
What's Changed
- Fix: Remove CKEditor 5 filler and placeholder content on submit by @skerbis in https://github.com/FriendsOfREDAXO/mblock/pull/224
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.5.4...4.5.5
4.5.4
Verbesserter Gridblock-Support
4.5.3
4.5.3
fixed: CKE5: Interne Links wurden in # umgeschrieben. redaxo links wurden als nicht gültig betrachtet
MBlock - REDAXO Addon für Modul-Input-Blöcke
Version 4.5.1 - 2025-11-26
Bug Fixes
- Double Icons: Fixed duplicate icons in copy/paste buttons when Bloecks addon is active.
- TinyMCE Drag & Drop: Fixed issue where TinyMCE editors became unresponsive after moving blocks (Drag & Drop or Arrow Buttons).
Version 4.5.0 - 2025-11-26
Features
- TinyMCE Support: Added full support for TinyMCE (v4, v5, v6, v7, v8) in MBlock instances.
- CKEditor 5 Improvements: Enhanced copy & paste functionality for CKEditor 5, ensuring content is correctly preserved and restored.
Improvements
- Code Modernization: Updated PHP classes to use strict types and modern array syntax.
- Performance: Optimized JavaScript for better editor initialization and cleanup.
- Cleanup: Removed debug code and unnecessary files.
fixed: https://github.com/FriendsOfREDAXO/mblock/issues/216
What's Changed
- 4.5.0 by @skerbis in https://github.com/FriendsOfREDAXO/mblock/pull/219
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.8...4.5.0
What's Changed
- Fix: Duplicate icons in copy/paste buttons when Bloecks is active (v4… by @skerbis in https://github.com/FriendsOfREDAXO/mblock/pull/220
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.5.0...4.5.1
4.3.7
Fixed:
Das aktuelle MBlock meldet bei mir einen JS-Fehler: MBlock: Sortable.js ist nicht verfügbar
@iceman-fx
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.6...4.3.7
4.3.6
What's Changed
- Fix translation placeholders by correcting to {{mblock::key}} format by @Copilot in https://github.com/FriendsOfREDAXO/mblock/pull/214
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.5...4.3.6
4.3.5
Fixes a JavaScript conflict between the mblock and search_it plugins by disabling toplevel variable mangling in the Terser minification configuration. The issue was causing "redeclaration of let h" errors when both plugins were active, preventing search_it's incremental indexing from working properly.
Disabled toplevel mangling in Terser configuration to preserve global variable names
Added explanatory comments documenting why this change was necessary
Prevents naming collisions while maintaining effective minification of local variables
4.3.4
What's Changed
- Fix media field ID mismatch after moving blocks by @Copilot in https://github.com/FriendsOfREDAXO/mblock/pull/209
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.3...4.3.4
4.3.3
4.3.2 - 4.3.3
What's Changed
- Change mblock language placeholders to {{mblock::key}} syntax by @Copilot in https://github.com/FriendsOfREDAXO/mblock/pull/205
New Contributors
- @Copilot made their first contribution in https://github.com/FriendsOfREDAXO/mblock/pull/205
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/4.3.1...4.3.2
4.2.1
4.2.0 🎉 :: Hello Gridblock
- Verbesserter Support für Gridblock
- Erweiterte Dokumentation
Hinweis für markitup- und ckeditor-Nutzer
Copy & Paste funktioniert leider nicht!
Es sollte in den betreffenden Modulen oder global in den Einstellungen deaktiviert werden.
Nicht traurig sein, dafür könnt ihr immerhin online/offline nun nutzen.
Beispiel
echo MBlock::show(1, $form, [
'min' => 1, // Minimale Anzahl Items
'max' => 10, // Maximale Anzahl Items
'template' => 'modern', // Template-Name
'copy_paste' => false, // Copy & Paste aktivieren
'online_offline' => true // Online/Offline Toggle , hidden field muss angelegt sein.
]);
4.1.1
🚨🚨🚨🚨🚨 4.0 - 4.1.1 NICHT FÜR GRIDBLOCK EINSETZEN 🚨🚨🚨🚨🚨
🚨🚨🚨🚨🚨Bitte noch die 3.x verwenden ... 4.2.0 wird es richten 🚨🚨🚨🚨🚨
Hier gibt's ein paar Fixes.
Alles wird wieder gut
Sorry an die Gridlockfreunde
3.4.13
What's Changed
- fix problems with iconv on some servers by @tyrant88 in https://github.com/FriendsOfREDAXO/mblock/pull/161
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.12...3.4.13
3.4.12
Behebt einen Darstellungsfehler, wenn kein initiales Fieldset gesetzt wurde.
3.4.11
Updated Examples to MForm >= 7
Added notice about MForm version
3.4.10
What's Changed
- fix Fix: "iconv illegal characters found..." by @tyrant88 in https://github.com/FriendsOfREDAXO/mblock/pull/157
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.9...3.4.10
3.4.9
What's Changed
- fix "Deprecated: mb_convert_encoding()" Warning by @tyrant88 in https://github.com/FriendsOfREDAXO/mblock/pull/156
New Contributors
- @tyrant88 made their first contribution in https://github.com/FriendsOfREDAXO/mblock/pull/156
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.8...3.4.9
3.4.8
What's Changed
- fix: typos by @eaCe in https://github.com/FriendsOfREDAXO/mblock/pull/154
- uses: actions/checkout@v3 by @alxndr-w in https://github.com/FriendsOfREDAXO/mblock/pull/155
New Contributors
- @alxndr-w made their first contribution in https://github.com/FriendsOfREDAXO/mblock/pull/155
Full Changelog: https://github.com/FriendsOfREDAXO/mblock/compare/3.4.7...3.4.8
3.4.7
Fixes an issue with PHP 8.1
https://github.com/FriendsOfREDAXO/mblock/commit/5092ac99a00f5e746c4f41a44e28b4bf3cf8abd9
3.4.6
Fix für Gridblock @https://github.com/iceman-fx/gridblock/issues/61
Danke @novinet-dsteffen @iceman-fx
3.4.5
PRESAVE-Action: Die REX_VALUES werden nach einer PRESAVE Aktion aus dem $_POST geladen.
Dadurch sind Validierungen ohne Neueingabe des Contents jetzt möglich. @skerbis
3.4.4
Fixes return types for YForm 4 in yform values
3.4.3
3.4.0 - 3.4.3
- Fixed: don't remove \' in media widget id
- Notice: add mblock:change and set rex:change to deprecated. rex:change will remove in next minor version
- Fixed: refresh disabled button status by drag and drop movements
- Fixed: don't add empty link and media list option
- dark mode support for REDAXO >= 5.13 thx to: @eaCe
- Compatibility: compare fix for REDAXO widgets
3.1.0
added rex:change event after item movements
3.0.0
ACHTUNG!!
Dies ist ein Major-Release.
- MBlock funktioniert nun vollständig mit rex:ready
Der verwendete Editor sollte rex:ready nutzen. - Spezieller Code für Editoren entfernt.
Ausführliche
Release-Notes:
https://github.com/FriendsOfREDAXO/mblock/releases/tag/3.0.0