Commit cf4e2daa authored by Richard Mansfield's avatar Richard Mansfield

Allow html to appear between label and element in pieforms

In some cases, it's useful to put explanatory text or html before a
pieform element, but after the label.  A 'prehtml' field is added to
the pieform renderers to achieve this.

This will be useful, for example, when the user is able to edit the
very last portion of a url, but not the full url.  The initial,
uneditable part can be displayed before the textbox, so that the user
is aware of the context for the field they're editing.

Change-Id: I721513ae7022401e959c5f8cddd9b45d9704a8b1
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent bc80fa0a
......@@ -47,6 +47,10 @@ function pieform_renderer_div(Pieform $form, $element) {/*{{{*/
$result .= $element['labelhtml'];
}
if (isset($element['prehtml'])) {
$result .= $element['prehtml'];
}
//$result .= $builtelement;
$result .= $element['html'];
......
......@@ -55,6 +55,10 @@ function pieform_renderer_oneline(Pieform $form, $element) {/*{{{*/
$result .= $element['labelhtml'];
}
if (isset($element['prehtml'])) {
$result .= $element['prehtml'];
}
$result .= $element['html'];
$result .= "</span>";
......
......@@ -74,6 +74,9 @@ function pieform_renderer_table(Pieform $form, $element) {/*{{{*/
$result .= $element['labelhtml'];
}
$result .= "</th>\n\t\t<td>";
if (isset($element['prehtml'])) {
$result .= $element['prehtml'];
}
$result .= $element['html'];
if (isset($element['helphtml'])) {
$result .= ' ' . $element['helphtml'];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment