Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Nov 17, 2023
1 parent d230fa4 commit 933d339
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Expand Up @@ -6,6 +6,7 @@
use Pushword\Admin\FormField\PageH1Field;
use Pushword\Admin\FormField\PageMainContentField;
use Pushword\Admin\PageAdmin;
use Pushword\Admin\PageCheatSheetAdmin;
use Pushword\Admin\Utils\FormFieldReplacer;
use Pushword\AdminBlockEditor\FormField\PageH1FormField;
use Pushword\AdminBlockEditor\FormField\PageImageFormField;
Expand All @@ -30,12 +31,20 @@ public static function getSubscribedEvents(): array
];
}

/**
* @param PersistenceEvent<PageInterface>|FormEvent<PageInterface> $event
*/
private function isPageAdmin(PersistenceEvent|FormEvent $event): bool
{
return $event->getAdmin() instanceof PageAdmin || $event->getAdmin() instanceof PageCheatSheetAdmin;
}

/**
* @param PersistenceEvent<PageInterface> $persistenceEvent
*/
public function setMainContent(PersistenceEvent $persistenceEvent): void
{
if (! $persistenceEvent->getAdmin() instanceof PageAdmin) {
if (! $this->isPageAdmin($persistenceEvent)) {
return;
}

Expand All @@ -56,11 +65,11 @@ public function setMainContent(PersistenceEvent $persistenceEvent): void
/**
* @psalm-suppress NoInterfaceProperties
*
* @param FormEvent<T> $formEvent
* @param FormEvent<PageInterface> $formEvent
*/
public function replaceFields(FormEvent $formEvent): void
{
if (! $formEvent->getAdmin() instanceof PageAdmin) {
if (! $this->isPageAdmin($formEvent)) {
return;
}

Expand Down
Binary file modified packages/skeleton/var/app.db
Binary file not shown.

0 comments on commit 933d339

Please sign in to comment.