Skip to content

Commit

Permalink
Metainfo: Feld-Notizen (#5234)
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Jul 18, 2022
1 parent 1089119 commit b74aa68
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
Binary file modified .github/tests-visual/metainfo_articles_add--dark.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/tests-visual/metainfo_articles_add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion redaxo/src/addons/metainfo/lang/de_de.lang
Expand Up @@ -42,7 +42,7 @@ minfo_field_params_notice_9 = Beispiel:<br /> <code>category="1"</code>
minfo_field_params_notice_10 = Beispiel:<br /> <code>start-year="1990" end-year="2030"</code>
minfo_field_params_notice_11 = Beispiel:<br /> <code>start-year="1990" end-year="2030"</code>

minfo_field_attributes_notice = HTML-Attribute beim input-Feld und Permissions, zum Beispiel:<br /><code>style="color:red;" multiple="multiple" class="my_css_class" perm="admin[]"</code>
minfo_field_attributes_notice = HTML-Attribute beim input-Feld und Permissions, zum Beispiel:<br /><code>style="color:red;" multiple="multiple" class="my_css_class" perm="admin[]" note="Notiz"</code>
minfo_field_label_notice = Code, der ausgeführt wird, wenn der Wert des Feldes geändert wird.<br /> Lesbare Variablen: <code>string $fieldName, string $fieldValue, rex_sql $field</code>

minfo_field_error_name = Bitte Spaltennamen eingeben!
Expand Down
2 changes: 1 addition & 1 deletion redaxo/src/addons/metainfo/lang/sv_se.lang
Expand Up @@ -42,7 +42,7 @@ minfo_field_params_notice_9 = Exempel:<br /> <code>category="1"</code>
minfo_field_params_notice_10 = Exempel:<br /> <code>start-year="1990" end-year="2030"</code>
minfo_field_params_notice_11 = Exempel:<br /> <code>start-year="1990" end-year="2030"</code>

minfo_field_attributes_notice = Exempel:<br /><code>style="color:red;" multiple="multiple" class="my_css_class" perm="admin[]"</code>
minfo_field_attributes_notice = Exempel:<br /><code>style="color:red;" multiple="multiple" class="my_css_class" perm="admin[]" note="note"</code>
minfo_field_label_notice = Kod som utförs om värdet av fältet ändras.<br /> Läsbara variablar: <code>string $fieldName, string $fieldValue, rex_sql $field</code>

minfo_field_error_name = Vänligen ange ett spaltnamn!
Expand Down
16 changes: 16 additions & 0 deletions redaxo/src/addons/metainfo/lib/handler/handler.php
Expand Up @@ -49,6 +49,12 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
unset($attrArray['perm']);
}

$note = null;
if (isset($attrArray['note'])) {
$note = $attrArray['note'];
unset($attrArray['note']);
}

// `rex_string::split` transforms attributes without value (like `disabled`, `data-foo` etc.) to an int based array element
// we transform them to array elements with the attribute name as key and empty value
foreach ($attrArray as $key => $value) {
Expand Down Expand Up @@ -107,6 +113,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand Down Expand Up @@ -182,6 +189,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e['label'] = '<label for="' . $currentId . '">' . rex_escape($value) . '</label>';
}
$e['field'] = '<input type="' . rex_escape($typeLabel) . '" name="' . rex_escape($name) . '" value="' . rex_escape($key) . '" id="' . $currentId . '" ' . $attrStr . $selected . ' />';
$e['note'] = $oneValue ? $note : null;
$formElements[] = $e;
}

Expand All @@ -202,6 +210,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand Down Expand Up @@ -264,6 +273,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand Down Expand Up @@ -320,6 +330,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand All @@ -342,6 +353,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand Down Expand Up @@ -387,6 +399,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand Down Expand Up @@ -422,6 +435,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand Down Expand Up @@ -452,6 +466,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand Down Expand Up @@ -483,6 +498,7 @@ public function renderMetaFields(rex_sql $sqlFields, array $epParams)
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$e['note'] = $note;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
Expand Down

0 comments on commit b74aa68

Please sign in to comment.