Skip to content

Commit 91b86ed

Browse files
committed
Configuration hints.
Adds support for configuration hints to the front-end.
1 parent ad13c79 commit 91b86ed

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/FrontEnd.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: Front-end handler (last modified: 2022.03.13).
11+
* This file: Front-end handler (last modified: 2022.03.17).
1212
*/
1313

1414
namespace phpMussel\FrontEnd;
@@ -1420,13 +1420,35 @@ public function view(string $Page = ''): void
14201420
$ThisDir['FieldOut'] .= '</small>';
14211421
}
14221422

1423+
/** Provide hints, useful for users to better understand the directive at hand. */
1424+
if (!empty($DirValue['hints'])) {
1425+
$ThisDir['Hints'] = $this->Loader->L10N->Data[$DirValue['hints']] ?? $DirValue['hints'];
1426+
if (!is_array($ThisDir['Hints'])) {
1427+
$ThisDir['Hints'] = [$ThisDir['Hints']];
1428+
}
1429+
foreach ($ThisDir['Hints'] as $ThisDir['HintKey'] => $ThisDir['HintValue']) {
1430+
if (is_int($ThisDir['HintKey'])) {
1431+
$ThisDir['FieldOut'] .= sprintf("\n<br /><br />%s", $ThisDir['HintValue']);
1432+
continue;
1433+
}
1434+
$ThisDir['FieldOut'] .= sprintf(
1435+
"\n<br /><br /><span class=\"s\">%s</span> %s",
1436+
$ThisDir['HintKey'],
1437+
$ThisDir['HintValue']
1438+
);
1439+
}
1440+
}
1441+
1442+
/** Provide additional information, useful for users to better understand the directive at hand. */
14231443
if (!empty($DirValue['See also']) && is_array($DirValue['See also'])) {
14241444
$ThisDir['FieldOut'] .= sprintf("\n<br /><br />%s<ul>\n", $this->Loader->L10N->getString('label_see_also'));
14251445
foreach ($DirValue['See also'] as $RefKey => $RefLink) {
14261446
$ThisDir['FieldOut'] .= sprintf('<li><a dir="ltr" href="%s">%s</a></li>', $RefLink, $RefKey);
14271447
}
14281448
$ThisDir['FieldOut'] .= "\n</ul>";
14291449
}
1450+
1451+
/** Finalise configuration row. */
14301452
$FE['ConfigFields'] .= $this->Loader->parse(
14311453
$this->Loader->L10N->Data,
14321454
$this->Loader->parse($ThisDir, $ConfigurationRow)

0 commit comments

Comments
 (0)