Skip to content

Plain HTML field and groups #299

Open
@frenzyk

Description

@frenzyk

It would be great to have plain HTML field. For example to generate headers. Now I have to do such hack:

 protected function addHeader($headerText)
    {
        $this
            /* Main Information */
            ->add('header' . $this->headerCounter, 'static', [
                'tag' => 'h3',
                'wrapper' => false,
                'attr' => ['class' => 'section-header clear'],
                'value' => $headerText,
                'label_show' => false,
            ])
            ->add('hr' . $this->headerCounter, 'static', [
                'tag' => 'div',
                'wrapper' => false,
                'attr' => ['class' => 'section-header'],
                'value' => '<hr/>',
                'label_show' => false,
            ]);

        $this->headerCounter++;
    }

Nothe that without headerCounter there will be Field [header] already exists in the form InvalidArgumentException. Assume some internal name iterator for such things or some flag with condition, like this:
vendor/kris/laravel-form-builder/src/Kris/LaravelFormBuilder/Form.php:218

        if ($field->isUnnamed()) {
            $this->fields[] = $field;
        } else {
            $this->fields[$field->getRealName()] = $field;
        }

Also sometime I feel great need for wrapping groups of elements (for horisontal aligment or to make tabs, for example). Assume some similar to routes grouping logic. Although I know it hard to implement=( For now I have to use custom fields to generate close/open tag

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions