diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2023-09-06 11:20:40 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2023-09-06 11:20:40 +0000 |
commit | 5a4b230f624b693c4429ccfa8ceab42cc726dc33 (patch) | |
tree | 789550ceb7d3ec6796a5c65a2e30ea8be0bf42f1 /scripts/forms.php | |
parent | 3aa8843b1fb47f8a00e470a898b142acae406dce (diff) | |
download | pmwiki.svn-5a4b230f624b693c4429ccfa8ceab42cc726dc33.tar.bz2 |
Add $InputLabelFmt configurable (PITS:01493).
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4492 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'scripts/forms.php')
-rw-r--r-- | scripts/forms.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/forms.php b/scripts/forms.php index 3cb8c226..95fcbdad 100644 --- a/scripts/forms.php +++ b/scripts/forms.php @@ -77,6 +77,8 @@ SDVA($InputTags['default'], array(':fn' => 'InputDefault')); SDVA($InputTags['defaults'], array(':fn' => 'InputDefault')); SDVA($InputTags['pmtoken'], array(':fn' => 'InputPmToken')); +SDV($InputLabelFmt, ' <label for="$LabelFor" $LabelTitle>$LabelText</label> '); + ## (:input ...:) directives Markup('input', 'directives', '/\\(:input\\s+(\\w+)(.*?):\\)/i', @@ -117,7 +119,7 @@ Markup('input+sp', '<split', function InputToHTML($pagename, $type, $args, &$opt) { global $InputTags, $InputAttrs, $InputValues, $FmtV, $KeepToken, $InputFocusLevel, $InputFocusId, $InputFocusFmt, $HTMLFooterFmt, - $EnableInputDataAttr; + $EnableInputDataAttr, $InputLabelFmt; if (!@$InputTags[$type]) return "(:input $type $args:)"; ## get input arguments if (!is_array($args)) $args = ParseArgs($args, '(?>([\\w-]+)[:=])'); @@ -177,8 +179,10 @@ function InputToHTML($pagename, $type, $args, &$opt) { if (isset($opt['label']) && strpos($InputTags[$type][':html'], '$InputFormLabel')!==false) { static $labelcnt = 0; if (!isset($opt['id'])) $opt['id'] = "lbl_". (++$labelcnt); - $lbtitle = isset($opt['title']) ? " title='".str_replace("'", ''', $opt['title'])."'" : ''; - $FmtV['$InputFormLabel'] = " <label for=\"{$opt['id']}\"$lbtitle>{$opt['label']}</label> "; + $FmtV['$LabelTitle'] = isset($opt['title']) ? " title='".str_replace("'", ''', $opt['title'])."'" : ''; + $FmtV['$LabelFor'] = $opt['id']; + $FmtV['$LabelText'] = $opt['label']; + $FmtV['$InputFormLabel'] = FmtPageName($InputLabelFmt, $pagename); } ## handle focus=# option if (@$opt['focus']) { |