public static function form_checkbox_builder($name, $type, $parameters, $label, $col, $i, $value, $data_type) { $array = []; if ($data_type == 'view') { $array = ['disabled' => true]; } if ($type == 'score' || $type == 'main_score') { $option_array = ['1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5']; } else { $option_array = $parameters['options']; } $response = '<div id="field_' . $name . '" class="col-sm-' . $col . ' ' . $parameters['field_class'] . '">'; $response .= '<label for="' . $name . '" class="control-label">' . $label . '</label>'; if ($type == 'checkbox') { $response .= '<div class="mt-checkbox-inline">'; } else { $response .= '<div class="mt-radio-inline">'; } foreach ($option_array as $key => $option) { $array['class'] = 'field_' . $name . ' option_' . $key; if ($type == 'radio' || $type == 'score' || $type == 'main_score') { $response .= '<label class="mt-radio">' . $option . ' ' . Form::radio($name, $key, AdminItem::make_radio_value($key, $value), $array); } else { if ($type == 'checkbox') { $response .= '<label class="mt-checkbox">' . $option . ' ' . Form::checkbox($name . '[]', $key, AdminItem::make_checkbox_value($key, $value), $array); } } $response .= '<span></span></label>'; } if (\Session::has('errors') && \Session::get('errors')->default->first($name)) { $response .= '<div class="error col-sm-12">' . \Session::get('errors')->default->first($name) . '</div>'; } if ($data_type == 'editor') { $response .= \Field::generate_editor_fields($name); } $response .= '</div></div>'; return $response; }