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 multiple form data tabs on parent view #315

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 17 additions & 5 deletions Admin/DynamicListAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,32 @@ public function __construct(ViewBuilderFactoryInterface $viewBuilderFactory, arr

public function configureViews(ViewCollection $viewCollection): void
{
$action = 'form-list';
// TODO handle multipage views

/** @var array<string, mixed> $sections */
foreach ($this->config as $parent => $sections) {
luca-rath marked this conversation as resolved.
Show resolved Hide resolved
if (!$viewCollection->has($parent)) {
continue;
}

$counter = 0;

/** @var mixed[] $config */
foreach ($sections as $key => $config) {
if (!$viewCollection->has($parent)) {
continue;
++$counter;

$action = 'form-list';
if ($counter > 1) {
$action .= '-' . str_replace('_', '-', $key);
}

$name = $parent . '.' . $action . '-key';
if (isset($config['name'])) {
$name = $config['name'];
}

if ($viewCollection->has($name)) {
throw new \RuntimeException(\sprintf('View "%s" does already exist.', $name));
}

$requestParameters = [
'type' => $config['type'],
];
Expand Down
43 changes: 4 additions & 39 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,53 +1,23 @@
parameters:
ignoreErrors:
-
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
count: 1
path: Admin/DynamicListAdmin.php

-
message: "#^Cannot access offset 'name' on mixed\\.$#"
count: 2
path: Admin/DynamicListAdmin.php

-
message: "#^Cannot access offset 'position' on mixed\\.$#"
count: 2
path: Admin/DynamicListAdmin.php

-
message: "#^Cannot access offset 'property' on mixed\\.$#"
count: 2
path: Admin/DynamicListAdmin.php

-
message: "#^Cannot access offset 'template' on mixed\\.$#"
count: 2
path: Admin/DynamicListAdmin.php

-
message: "#^Cannot access offset 'type' on mixed\\.$#"
message: "#^Parameter \\#1 \\$name of method Sulu\\\\Bundle\\\\AdminBundle\\\\Admin\\\\View\\\\ViewBuilderFactoryInterface\\:\\:createListViewBuilder\\(\\) expects string, mixed given\\.$#"
count: 1
path: Admin/DynamicListAdmin.php

-
message: "#^Cannot access offset 'view' on mixed\\.$#"
count: 2
path: Admin/DynamicListAdmin.php

-
message: "#^Parameter \\#1 \\$name of method Sulu\\\\Bundle\\\\AdminBundle\\\\Admin\\\\View\\\\ViewBuilderFactoryInterface\\:\\:createListViewBuilder\\(\\) expects string, mixed given\\.$#"
message: "#^Parameter \\#1 \\$tabOrder of method Sulu\\\\Bundle\\\\AdminBundle\\\\Admin\\\\View\\\\ListViewBuilderInterface\\:\\:setTabOrder\\(\\) expects int, mixed given\\.$#"
count: 1
path: Admin/DynamicListAdmin.php

-
message: "#^Parameter \\#1 \\$tabOrder of method Sulu\\\\Bundle\\\\AdminBundle\\\\Admin\\\\View\\\\ListViewBuilderInterface\\:\\:setTabOrder\\(\\) expects int, mixed given\\.$#"
message: "#^Parameter \\#1 \\$viewName of method Sulu\\\\Bundle\\\\AdminBundle\\\\Admin\\\\View\\\\ViewCollection\\:\\:has\\(\\) expects string, mixed given\\.$#"
count: 1
path: Admin/DynamicListAdmin.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
count: 2
path: Admin/DynamicListAdmin.php

-
Expand Down Expand Up @@ -330,11 +300,6 @@ parameters:
count: 1
path: Controller/FormTokenController.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Form\\\\FormError\\|Symfony\\\\Component\\\\Form\\\\FormErrorIterator\\:\\:getMessage\\(\\)\\.$#"
count: 2
path: Controller/FormWebsiteController.php

-
message: "#^Cannot call method all\\(\\) on Symfony\\\\Component\\\\Form\\\\FormInterface\\|null\\.$#"
count: 1
Expand Down