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 to initialize CascadeDropdown values #1659

Merged
merged 7 commits into from
Oct 3, 2021

Conversation

ibelar
Copy link
Contributor

@ibelar ibelar commented Sep 14, 2021

Two values for proper initialization of the DropdownCascade is need: The actual value of the dropdown and the reference value for populating the dropdown items.

Usage:

$form = Form::addTo($app);

$form->addControl('cat', [Form\Control\Dropdown::class, 'model' => new Category($app->db)])->set(2);

$form->addControl('sub', [Form\Control\DropdownCascade::class, 'cascadeFrom' => 'cat', 'reference' => Category::hinting()->fieldName()->SubCategories])->set(9);

$form->addControl('prod', [Form\Control\DropdownCascade::class, 'cascadeFrom' => 'sub', 'reference' => SubCategory::hinting()->fieldName()->Products])->set(3)

Screen Shot 2021-09-14 at 3 10 11 PM

@mvorisek
Copy link
Member

mvorisek commented Sep 15, 2021

If the 'category_id' and 'sub_category_id' is from some demo/doc, replace it with SubCategory::hinting()->fieldName()->...

Also check the default values in Behat test.

@ibelar ibelar added the RTM label Sep 25, 2021
@mvorisek mvorisek merged commit 6282ae5 into develop Oct 3, 2021
@mvorisek mvorisek deleted the feature/cascade-dropdown-init-value branch October 3, 2021 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants