From 5af6380434664dc296d3fd47688d94d2a58cc2a5 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 2 Jun 2012 17:49:20 +0000 Subject: [PATCH] allow set id for subtitles --- lam/lib/html.inc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index cdc3d6a5..d3d45639 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -2133,16 +2133,20 @@ class htmlSubTitle extends htmlElement { private $label = null; /** optional image */ private $image = null; + /** optional ID for this element (e.g. to use for JavaScript) */ + private $id = null; /** * Constructor. * * @param String $label label * @param String $image optional image + * @param String $id optional ID for this element (e.g. to use for JavaScript) */ - function __construct($label, $image = null) { + function __construct($label, $image = null, $id = null) { $this->label = htmlspecialchars($label); $this->image = htmlspecialchars($image); + $this->id = htmlspecialchars($id); // the title should not end at a table cell $this->colspan = 100; } @@ -2159,7 +2163,11 @@ class htmlSubTitle extends htmlElement { * @return array List of input field names and their type (name => type) */ function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) { - echo "
\n"; + $idValue = ''; + if ($this->id != null) { + $idValue = ' id="' . $this->id . '"'; + } + echo "
\n"; echo "

\n"; if ($this->image != null) { echo '' . $this->label . ' ';