Closed Tofandel closed 8 months ago
@Tofandel related discussion here: https://github.com/area17/twill/issues/2424#issuecomment-1931642021
I figured it could be true and I in fact worked around it using the key 1, but it's not clean and just a workaround and not what the doc says to use, so I fixed the condition so that now any array with a single string in it, no matter its key will work correctly
It handles [Post::class]
or ['post' => Post::class]
as a single module and [['name' => 'Post']]
as multiple modules which is the normally expected behaviour
I'm totally with you on this, just wanted to relate the 2 discussions and give more context to avoid introducing any breaking changes.
The documentation refers to a
moduleName
option for a single module browser, which doesn't seem to exist on the form builder, the code suggests that it should be possible usingmodules([Module::class])
and so does the docAnd so the previous form field should be a browser for a single module
However that's not the case as can be seen from the dropdown
This is due to
count($modules) === 1 && ! isset($modules[0])
which doesn't make much logical senseWith the PR this is what becomes: