Esempio n. 1
0
 /**
  * Create a checkbox input field.
  *
  * @param  string $name
  * @param  mixed $value
  * @param  bool $checked
  * @param  array $options
  * @return string
  */
 public function checkbox($name, $value = 1, $checked = null, $options = array())
 {
     $label = array_get($options, 'label', $this->translationDomain ? $this->translationDomain . '.' . $name : $name);
     unset($options['label']);
     $label = \Lang::get($label);
     return '<div class="checkbox"><label>' . $this->form->checkbox($name, $value, $checked, $options) . $label . '</label></div>';
 }
 /**
  * Create a Bootstrap checkbox input.
  *
  * @param  string   $name
  * @param  string   $label
  * @param  string   $value
  * @param  boolean  $checked
  * @param  boolean  $inline
  * @param  boolean  $wrapper
  * @param  array    $options
  * @return string
  */
 public function checkbox($name, $label, $value, $checked = null, $inline = false, $options = array())
 {
     $labelOptions = $inline ? array('class' => 'checkbox-inline') : array();
     $inputElement = $this->form->checkbox($name, $value, $checked, $options);
     $labelElement = '<label ' . $this->html->attributes($labelOptions) . '>' . $inputElement . $label . '</label>';
     return $inline ? $labelElement : '<div class="checkbox">' . $labelElement . '</div>';
 }
Esempio n. 3
0
 /**
  * Prepare data grid columns.
  *
  * @param  bool  $results
  * @return array
  */
 protected function prepareColumns($model)
 {
     $el = [];
     foreach ($this->dataGridColumns as $attributes) {
         $type = array_pull($attributes, 'type');
         if ($type) {
             if ($type === 'a') {
                 $elementContent = '<%= r.' . array_pull($attributes, 'content') . ' %>';
                 $link = $this->html->decode($this->html->link('#', $elementContent, $attributes));
                 $link = str_replace('href="#"', 'href="<%= r.edit_uri %>"', $link);
                 $el[] = $link;
             } elseif ($type === 'checkbox') {
                 $checkBoxName = array_pull($attributes, 'name');
                 $value = array_pull($attributes, 'value');
                 $value = '<%= r.' . $value . ' %>';
                 $el[] = $this->html->decode($this->form->checkbox($checkBoxName, $value, null, $attributes));
             }
         } else {
             $el[] = '<%= r.' . array_pull($attributes, 'content') . ' %>';
         }
     }
     return $el;
 }
Esempio n. 4
0
 /**
  * Create a checkbox input field.
  *
  * @param string $name
  * @param mixed $value
  * @param bool $checked
  * @param array $options
  * @return string 
  * @static 
  */
 public static function checkbox($name, $value = 1, $checked = null, $options = array())
 {
     return \Illuminate\Html\FormBuilder::checkbox($name, $value, $checked, $options);
 }
Esempio n. 5
0
 /**
  * Create a HTML checkbox input element.
  *
  * @param  string  $name
  * @param  string  $label
  * @param  string  $value
  * @param  bool    $checked
  * @param  array   $attributes
  * @return string
  */
 public function checkbox($name, $label = '', $value = '1', $checked = false, $attributes = array())
 {
     $checked = $this->calculateValue($name, $checked);
     $attributes = $this->setAttributes($name, $attributes, false);
     $field = parent::checkbox($name, $value, $checked, $attributes);
     return $this->buildWrapper($field, $name, $label, true);
 }
Esempio n. 6
0
 /**
  * Generate a checkbox input field
  *
  * @param string $name
  * @param string $value
  * @param array  $options
  *
  * @return string
  */
 public function checkbox($name, $value = null, $options = [])
 {
     $checked = $value === 1 || $value === "1" || $value === true ? true : null;
     return $this->formBuilder->checkbox($name, 1, $checked, $options);
 }
 /**
  * @param Field $field
  * @return string
  */
 public function checkboxField(Field $field)
 {
     return $this->builder->checkbox($field->name, $field->value, $field->checked, $field->getAttributes());
 }
 /**
  * Create an inline checkbox input field.
  *
  * @param  string $name
  * @param  mixed  $value
  * @param  mixed  $label
  * @param  bool   $checked
  * @param  array  $options
  *
  * @return string
  */
 public function inlineCheckbox($name, $value = 1, $label = null, $checked = null, $options = [])
 {
     $checkable = parent::checkbox($name, $value, $checked, $options);
     return $this->wrapInlineCheckable($label, 'checkbox', $checkable);
 }
Esempio n. 9
0
 /**
  * Create a checkbox input field.
  *
  * @param  string  $name
  * @param  mixed   $value
  * @param  bool    $checked
  * @param  array   $options
  * @return string
  */
 public function checkbox($name, $value = 1, $checked = null, $options = array())
 {
     $this->appendReadOnly($options);
     return parent::checkbox($name, $value, $checked, $options);
 }