Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extending of page edit record forms #1938

Open
wants to merge 4 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function getFormActions(): array
];
}

public function form(Form $form): Form
public function getDefaultForm(Form $form): Form
{
return (new ManageVariantInventory)->form($form)->statePath('');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function getDefaultHeaderActions(): array
];
}

public function form(Form $form): Form
public function getDefaultForm(Form $form): Form
{
return $form->schema([
Section::make()->schema([
Expand Down
1 change: 1 addition & 0 deletions packages/admin/src/Support/Pages/BaseEditRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ abstract class BaseEditRecord extends EditRecord
{
use Concerns\ExtendsFooterWidgets;
use Concerns\ExtendsFormActions;
use Concerns\ExtendsForms;
ryanmitchell marked this conversation as resolved.
Show resolved Hide resolved
use Concerns\ExtendsHeaderActions;
use Concerns\ExtendsHeaderWidgets;
use Concerns\ExtendsHeadings;
Expand Down
18 changes: 18 additions & 0 deletions packages/admin/src/Support/Pages/Concerns/ExtendsForms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Lunar\Admin\Support\Pages\Concerns;

use Filament\Forms\Form;

trait ExtendsForms
{
public function form(Form $form): Form
{
return self::callLunarHook('extendForm', $this->getDefaultForm($form));
}

public function getDefaultForm(Form $form): Form
{
return $form;
}
}
Loading