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

Source for file block.forminput.php

Documentation is available at block.forminput.php

  1. <?php 
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7.  
  8. /**
  9.  * Smarty {forminput} block plugin
  10.  *
  11.  * Type:     block
  12.  * Name:     forminput
  13.  */
  14. function smarty_block_forminput($params, $content, &$gBitSmarty) {
  15.     global $gSmartyFormHorizontal;
  16.  
  17.     // defaults
  18.     $attr = "";
  19.     $class = '';
  20.     if( $gSmartyFormHorizontal ) {
  21.         $class = 'col-sm-8';
  22.     }
  23.  
  24.     if( !empty( $params['class'] ) ){
  25.         $class .= ' '.trim( $params['class'] );
  26.         if( $gSmartyFormHorizontal && (strpos( $params['class'], 'submit' ) !== FALSE || strpos( $params['class'], 'offset' ) !== FALSE) ) {
  27.             $class .= ' col-sm-offset-4';
  28.         }
  29.     }
  30.  
  31.     $labelStart = '';
  32.     $labelEnd = '';
  33.  
  34.     if( !empty( $params['label'] ) ){
  35.         if( $gSmartyFormHorizontal ) {
  36.             $class .= ' col-sm-offset-4';
  37.         }
  38.         $class .= ' '.trim( $params['label'] );
  39.         $labelStart = '<label>';
  40.         $labelEnd = '</label>';
  41.     }
  42.  
  43.     if( !empty( $params['id'] ) ){
  44.         $attr .= 'id="'.trim( $params['id'] ).'" ';
  45.     }
  46.  
  47.     if( !empty( $params['style'] ) ){
  48.         $attr .= 'style="'.trim( $params['style'] ).'" ';
  49.     }
  50.  
  51.     if( $content ) {
  52.         return '<div class="'.$class.'" '.$attr.' >'.$labelStart.$content.$labelEnd.'</div>';
  53.     }
  54. }
  55. ?>

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