Skip to content

v7.27.1

Compare
Choose a tag to compare
@dvlpp dvlpp released this 28 Apr 09:13
· 516 commits to main since this release

New feature (well, not really, hence the patch versioning)

  • added a few methods on the layout API to allow field insertion:
    • FormLayout::getColumn($index)
    • FormLayoutTab::getColumn($index)
    • LayoutColumn::insertSingleFieldAt($index, $fieldKey)
    • LayoutColumn::insertFieldsAt($index, ...$fieldKeys)

Usage example, in a inherited Form:

class MyForm extends AnotherExistingForm
{
    public function buildFormFields(FieldsContainer $formFields): void
    {
        parent::buildFormFields($formFields);

        $formFields->addField(SharpFormTextField::make('additional_field'));
    }

    public function buildFormLayout(FormLayout $formLayout): void
    {
        parent::buildFormLayout($formLayout);

        $this->formLayout
            ->getColumn(0)
            ->insertSingleFieldAt(0, 'additional_field');
    }
}