v7.27.1
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');
}
}