public function formCreate($fields)
    {
        $output = '';

        foreach ($fields as $f) {
            $ucF = ucfirst($f);

            $input_attr = [
                'class' => 'form-control',
                'id' => 'createItem'.$f,
                'name' => $f,
            ];

            $label = $this->humanReadableField($ucF);

            $output .= '<fieldset class="form-group">';

            $output .= '<label for="'.$input_attr['id'].'">'.$label.'</label>';

            if ($this->isIdField($f)) {
                $input_attr['type'] = 'select';

                $output .= '<select ';
                foreach ($input_attr as $attr => $value) {
                    $output .= "{$attr}='{$value}'";
                }

                $relation = $this->crudApi->getRelatedModel($f);
                $output .= '>';

                $output .= $this->crudApi->getRelatedOptions($relation);

                $output .= '</select>';
            } else {
                $input_attr['type'] = 'text';

                $output .= '<input ';
                foreach ($input_attr as $attr => $value) {
                    $output .= "{$attr}='{$value}'";
                }
                $output .= '>';
            }

            $output .= '</fieldset>';
        }

        return $output;
    }
public function formCreate($fields)
    {
        $output = '';

        foreach ($fields as $f) {
            $ucF = ucfirst($f);

            $input_attr = [
                'class' => 'form-control',
                'id' => 'createItem'.$f,
                'name' => $f,
            ];

            $label = $this->humanReadableField($ucF);

            $output .= '<fieldset class="form-group">';

            $output .= '<label for="'.$input_attr['id'].'">'.$label.'</label>';

            if ($this->isIdField($f)) {
                $input_attr['type'] = 'select';

                $output .= '<select ';
                foreach ($input_attr as $attr => $value) {
                    $output .= "{$attr}='{$value}'";
                }

                $relation = $this->crudApi->getRelatedModel($f);
                $output .= '>';

                $output .= $this->crudApi->getRelatedOptions($relation);

                $output .= '</select>';
            } else {
                $input_attr['type'] = 'text';

                $output .= '<input ';
                foreach ($input_attr as $attr => $value) {
                    $output .= "{$attr}='{$value}'";
                }
                $output .= '>';
            }

            $output .= '</fieldset>';
        }

        return $output;
    }
public function formCreate ( $ fields ) { $ output = '' ; foreach ( $ fields as $ f ) { $ ucF = ucfirst ( $ f ) ; $ input_attr = [ 'class' => 'form-control' , 'id' => 'createItem' . $ f , 'name' => $ f , ] ; $ label = $ this -> humanReadableField ( $ ucF ) ; $ output .= '<fieldset class="form-group">' ; $ output .= '<label for="' . $ input_attr [ 'id' ] . '">' . $ label . '</label>' ; if ( $ this -> isIdField ( $ f ) ) { $ input_attr [ 'type' ] = 'select' ; $ output .= '<select ' ; foreach ( $ input_attr as $ attr => $ value ) { $ output .= "{$attr}='{$value}'" ; } $ relation = $ this -> crudApi -> getRelatedModel ( $ f ) ; $ output .= '>' ; $ output .= $ this -> crudApi -> getRelatedOptions ( $ relation ) ; $ output .= '</select>' ; } else { $ input_attr [ 'type' ] = 'text' ; $ output .= '<input ' ; foreach ( $ input_attr as $ attr => $ value ) { $ output .= "{$attr}='{$value}'" ; } $ output .= '>' ; } $ output .= '</fieldset>' ; } return $ output ; }
Render fields into appropriate format for an item creation form.

@param $fields

@return string
Render fields into appropriate format for an item creation form .