コード例 #1
0
ファイル: Checkbox.php プロジェクト: kemosabhay/Lightning
 public static function render($name, $value = '', $checked = false)
 {
     $attributes = array('type' => 'checkbox', 'value' => $value, 'name' => $name, 'id' => $name);
     if ($checked) {
         $attributes['checked'] = 'CHECKED';
     }
     return '<input ' . HTML::implodeAttributes($attributes) . ' />';
 }
コード例 #2
0
ファイル: Text.php プロジェクト: kemosabhay/Lightning
 /**
  * Build a text field.
  *
  * @param $id
  * @param $value
  * @param array $options
  *
  * @return string
  *   The rendered HTML.
  */
 public static function textField($id, $value, $options = array())
 {
     $attributes['class'] = !empty($options['classes']) ? $options['classes'] : array();
     if (isset($options['autocomplete'])) {
         $attributes['autocomplete'] = empty($options['autocomplete']) ? 'off' : 'on';
     }
     if (!empty($options['size'])) {
         $attributes['max_length'] = $options['size'];
     }
     $attributes['name'] = $id;
     $attributes['id'] = $id;
     $attributes['value'] = $value;
     $attributes['type'] = 'text';
     return '<input ' . HTML::implodeAttributes($attributes) . ' />';
 }