Revision: 2947
          https://sourceforge.net/p/mrbs/code/2947/
Author:   cimorrison
Date:     2015-01-16 11:33:58 +0000 (Fri, 16 Jan 2015)
Log Message:
-----------
Added the ability to add a title to a checkbox label

Modified Paths:
--------------
    mrbs/trunk/web/functions.inc

Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc        2015-01-15 09:34:48 UTC (rev 2946)
+++ mrbs/trunk/web/functions.inc        2015-01-16 11:33:58 UTC (rev 2947)
@@ -548,6 +548,7 @@
 //        'name'        The name of the element.
 //      OPTIONAL
 //        'label_after' Whether to put the label before or after the checkbox. 
 Default FALSE
+//        'label_title' The text to be used for the title attribute for the 
field label
 //        'id'          The id of the element.  Defaults to be the same as the 
name.
 //        'value'       The value of the input.  Default ''
 //        'class'       A class (or array of classes) to give the element.  
Default NULL
@@ -559,7 +560,7 @@
 function generate_checkbox($params)
 {
   // some sanity checking on params
-  foreach (array('label', 'name', 'id', 'label_after', 'value', 'class',
+  foreach (array('label', 'label_title', 'name', 'id', 'label_after', 'value', 
'class',
                  'disabled', 'mandatory', 'attributes') as $key)
   {
     if (!isset($params[$key]))
@@ -574,6 +575,7 @@
           $params[$key] = $params['name'];
           break;
         case 'value':
+        case 'label_title':
           $params[$key] = '';
           break;
         case 'disabled':
@@ -604,6 +606,7 @@
   // generate the HTML
   // no HTML escaping for the label - it is trusted
   $html  = "<label for=\"" . $params['id'] . "\"";
+  $html .= (empty($params['label_title'])) ? '' : ' title="' . 
htmlspecialchars($params['label_title']) . '"';
   $html .= ($params['label_after']) ? ' class="secondary"' : '';
   $html .= ">";
   if (!$params['label_after'])
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to