We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
First of all, thank you for this awesome library. Awesome work.
I don't have a reproducer, but here is an excerpt from the form type causing issues
foreach (CustomFieldDefinitionEntity::supportedModules() as $module) { // this works fine as there is just one dependency 'modules' $builder ->addDependent($module, 'modules', function (DependentField $field, ?array $modules) use ($module) { $insertionPoints = [...]; $field->add(ChoiceType::class, [ 'choices' => $insertionPoints, 'disabled' => !\in_array($module, $modules ?? [], true), 'required' => true, 'getter' => fn (CustomFieldDefinition $fieldDefinition) => $fieldDefinition->placement[$module] ?? "{$module}.default", 'setter' => function (CustomFieldDefinition $fieldDefinition, ?string $value) use ($module): void { $fieldDefinition->placement[$module] = StringFunctions::emptyStringToNull($value) ?? "{$module}.default"; }, ]); }) ; } // this doesn't use submitted values of the child added above // (value-of<CustomFieldDefinitionEntity::supportedModules()>), // it uses default values (initial form values), // the only difference is that this has multiple dependencies // unlike above which is just dependent upon a single field. foreach (CustomFieldDefinitionEntity::ALLOWED_PROPAGATIONS as $propagationSource => $propagationDestinations) { $builder ->addDependent("propagation_{$propagationSource}", CustomFieldDefinitionEntity::supportedModules(), function (DependentField $field, ...$modules) use ($builder, $propagationDestinations, $propagationSource): void { // `$modules` doesn't contain submitted data $field->add(ChoiceType::class, [ 'multiple' => true, 'choices' => [...], 'choice_attr' => $choiceAttributes, 'required' => false, 'expanded' => true, 'getter' => fn (CustomFieldDefinition $fieldDefinition) => $fieldDefinition->propagations[$propagationSource] ?? [], 'setter' => function ( CustomFieldDefinition $fieldDefinition, ?array $destinations, FormInterface $form ) use ($propagationSource): void { $fieldDefinition->propagations[$propagationSource] = $destinations ?? []; }, ]); }) ; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
First of all, thank you for this awesome library. Awesome work.
I don't have a reproducer, but here is an excerpt from the form type causing issues
The text was updated successfully, but these errors were encountered: