From e7310768294be3872d3ba7f3d5e7c4d15d8623f1 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 7 Sep 2010 18:11:33 +0000 Subject: [PATCH] allow title attribute for buttons --- lam/lib/html.inc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 0892f8fd..49bcccf9 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -485,6 +485,8 @@ class htmlButton extends htmlElement { protected $value; /** image button or text button */ protected $isImageButton; + /** title */ + private $title = null; /** * Constructor. @@ -514,6 +516,7 @@ class htmlButton extends htmlElement { $value = ''; $style = ''; $class = ''; + $title = ''; $name = ' name="' . $this->name . '"'; // image button if ($this->isImageButton) { @@ -527,10 +530,22 @@ class htmlButton extends htmlElement { $value = ' value="' . $this->value . '"'; } } - echo ''; + if ($this->title != null) { + $title = ' title="' . $this->title . '"'; + } + echo ''; return array($this->name => 'submit'); } + /** + * Sets the button title (tooltip). + * + * @param String $title title + */ + public function setTitle($title) { + $this->title = htmlspecialchars($title); + } + } /**