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
Add more tests #1537
Add more tests #1537
Conversation
@@ -98,6 +98,10 @@ protected function configureRoutes(RouteCollectionInterface $collection): void | |||
$collection->add('composePreview', '{block_id}/compose_preview', [ | |||
'block_id' => null, | |||
]); | |||
|
|||
if (!$this->isChild()) { | |||
$collection->remove('create'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like a BlockAdmin can't be created unless is child of page or is a sharedBlock (another admin)
$form->add('enabled', HiddenType::class, ['data' => true]); | ||
} else { | ||
$form->add('enabled'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double added enabled (was added by the configureBlockFields above), it was also added in another block, and sonata complains about double property enabled.
@@ -86,8 +86,7 @@ public function createAction(Request $request): Response | |||
{ | |||
$this->admin->checkAccess('create'); | |||
|
|||
$sharedBlockAdminClass = $this->getParameter('sonata.page.admin.shared_block.class'); | |||
if (!$this->admin->isChild() && \get_class($this->admin) !== $sharedBlockAdminClass) { | |||
if (!$this->admin->isChild()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a weird hack to avoid creating a block outside child or shared admin, was better solved with the other solution
@@ -162,6 +161,7 @@ public function composePreviewAction(Request $request): Response | |||
'container' => $container, | |||
'child' => $block, | |||
'blockServices' => $blockServices, | |||
'blockAdmin' => $this->admin, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix missing variable previously changed on my other PR.
@@ -58,6 +58,7 @@ | |||
'controller' => 'sonata.page.controller.admin.block', | |||
'manager_type' => 'orm', | |||
'show_in_dashboard' => false, | |||
'default' => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 admins for same class, I made blockadmin the default one.
@@ -14,7 +14,7 @@ | |||
{% set metadata = service.blockMetadata %} | |||
{% endif %} | |||
<h4 class="page-composer__container__child__name"> | |||
{{ child.name|default(service.name)|trans({}, service.blockMetadata.domain|default('SonataPageBundle')) }} | |||
{{ child.name|default(metadata.title)|trans({}, metadata.domain|default('SonataPageBundle')) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
completely broken too.
Can you update #1495 (comment) if you fixed some |
I think I fixed other issues that are not detected yet 😓 |
Subject
I am targeting this branch, because this is fixing bugs present only on 4.x.
2 Commits again: