Smarty
[ class tree: Smarty ] [ index: Smarty ] [ all elements ]

Source for file function.formlabel.php

Documentation is available at function.formlabel.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7.  
  8. /**
  9.  * Smarty {formlabel} function plugin
  10.  *
  11.  * Type:     function
  12.  * Name:     formlabel
  13.  * Input:
  14.  *           - label       (required) - words that are displayed
  15.  *          - mandatory (optional) - add a class formmandatory in the div
  16.  */
  17. function smarty_function_formlabel$params,&$gBitSmarty {
  18.     global $gSmartyFormHorizontal;
  19.     $atts '';
  20.     $class 'control-label';
  21.     if$gSmartyFormHorizontal {
  22.         $class .= ' col-sm-4';
  23.     }
  24.     foreach($params as $key => $val{
  25.         switch$key {
  26.             case 'label':
  27.                 $name $val;
  28.                 break;
  29.             case 'mandatory':
  30.                 $mandatory true;
  31.             case 'class':
  32.                 $class .= ' '.$val;
  33.             default:
  34.                 if$val {
  35.                     $atts .= ' '.$key.'="'.$val.'"';
  36.                 }
  37.                 break;
  38.         }
  39.     }
  40.     $html '<label class="'.$class.'" ';
  41.     if (isset($mandatory&& $mandatory{
  42.         $html .= ' required';
  43.     }
  44.     if$atts != '' {
  45.         $html .= $atts;
  46.     }
  47.     $html .= '>';
  48.     ifempty$params['no_translate') ) {
  49.         $html .= tra$name );
  50.     else {
  51.         $html .= $name;
  52.     }
  53.     $html .= '</label>';
  54.     return $html;
  55. }
  56. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:37 +0000 by phpDocumentor 1.5.0-lsces