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

The option "position" does not exist. #5

Closed
lars-feyerabend opened this issue Oct 17, 2013 · 8 comments
Closed

The option "position" does not exist. #5

lars-feyerabend opened this issue Oct 17, 2013 · 8 comments

Comments

@lars-feyerabend
Copy link

I can't seem to get the bundle running. Whenever I add the position option like in the examples, I get the above error.

The form.resolved_type_factory is set correctly in container:debug, and stepping through the various Form classes with XDebug shows that the Ivory* classes are indeed involved. But the OptionsResolver doesn't seem to recognize the option...

Any idea what to check or how to fix this?

@egeloen
Copy link
Owner

egeloen commented Oct 17, 2013

The option is added on every form types through a form type extension. The ordered resolved type factory is only here in order to order field when the view is created. Can you check if the extension is well loaded?

@lars-feyerabend
Copy link
Author

Well, container:debug shows it loaded:

$ sf container:debug | grep Ivory
form.resolved_type_factory                          container Ivory\OrderedFormBundle\Form\OrderedResolvedFormTypeFactory
ivory_ordered_form.form_extension                   container Ivory\OrderedFormBundle\Form\Extension\OrderedFormExtension

And, with or without any position option set, breakpoints in both OrderedFormExtension::buildForm and OrderedFormExtension::setDefaultOptions get triggered as well.

(If you got the notification about my second comment, scratch that. That was my incompetence to use the debugger.)

@lars-feyerabend
Copy link
Author

Okay, I've narrowed it down! It specifically doesn't work for submit fields.

This works as intended:

$builder->add('foo', 'text', ['position' => 'last']);

This doesn't (throws error about position option):

$builder->add('submit', 'submit', ['position' => 'last']);

@egeloen
Copy link
Owner

egeloen commented Oct 18, 2013

Okay I will investigate. Thanks for your feedback!

@tweini
Copy link
Contributor

tweini commented Oct 26, 2013

As this extension works as a form extension, it extends all formtypes based on FormType. The SubmitType (and the ResetType) are based on ButtonType. A FormExtension can only extend one Type, and before the ButtonType was added to the Form Component, FormType was the one and only 'Root', so this has worked. Sorry for that bad news.

@egeloen
Copy link
Owner

egeloen commented Oct 26, 2013

@tweini We just need to provide the same extension but on the form and on the button type. Am I right?

@tweini
Copy link
Contributor

tweini commented Oct 26, 2013

Yeah. Simply extend the extension, overwrite getExtendedType, register the new extension in config.xml an the job should be done. I can give you a PR later on, when i am at PC. I am at iPad, an typing without the code formating stuff and so on is hell. - btw i wish the getExtendedType could return an Array of Types you wanna extend. I had a use case with the same problem. I will try to place it as a enhancement for form component.

@tweini tweini mentioned this issue Oct 27, 2013
@tweini
Copy link
Contributor

tweini commented Oct 27, 2013

@egeloen hope that works ;-)

@egeloen egeloen closed this as completed Oct 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants