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

Incorrect documentation for overriding the view of a resource form #362

Open
DanielCAlex opened this issue Feb 1, 2022 · 4 comments · May be fixed by #363
Open

Incorrect documentation for overriding the view of a resource form #362

DanielCAlex opened this issue Feb 1, 2022 · 4 comments · May be fixed by #363
Labels
Bug Confirmed bugs or bugfixes.

Comments

@DanielCAlex
Copy link

latest

The config reference suggests to overwrite a resource's form rendering as such

sylius_resource:
    resources:
        app.book:
            driver: doctrine/orm
            classes:
            options:
                object_manager: default
            templates:
                form: Book/_form.html.twig

However Configuration.php suggests the only acceptable value is a scalar

 private function addResourcesSection(ArrayNodeDefinition $node): void
    {
        $node
            ->children()
                ->arrayNode('resources')
                    ->useAttributeAsKey('name')
                    ->arrayPrototype()
                        ->children()
                            ->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
                            ->variableNode('options')->end()
                            ->scalarNode('templates')->cannotBeEmpty()->end()

So when I configure:

sylius_resource:
  resources:
etc etc etc
      templates:
        form: Admin/Ruleset/_form.html.twig

I get:
Invalid type for path "sylius_resource.resources.skyboundtech.wholesale_ruleset.templates". Expected "scalar", but got "array".

@loic425 loic425 linked a pull request Feb 1, 2022 that will close this issue
@loic425
Copy link
Member

loic425 commented Feb 1, 2022

Yes I've tried this one and this templates is to customize templates namespace for a resource like you do in crud routing configuration.

@loic425 loic425 added the Bug Confirmed bugs or bugfixes. label Feb 1, 2022
@DanielCAlex
Copy link
Author

What would be the proper way to go about overriding the form template without overriding the entire namespace?

@loic425
Copy link
Member

loic425 commented Feb 2, 2022

@DanielCAlex
Copy link
Author

Thank you for the direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bugs or bugfixes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants