-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
new cookbook article on using empty data for form classes #2415
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
Conversation
|
||
Option 1: instantiate a new class: | ||
|
||
.. code-block:: php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me teach you some harder Shpinx formatting:
Instead of
lorem ipsum, see this example:
.. code-block:: php
// ... some PHP code
You can use:
lorem ipsum, see the example::
// ... some PHP code
(notice the double colon at the end). Both are rendered the same (as code defaults to PHP on Symfony.com) and we prefer the last one.
Thanks for the feedback. I will send an updated PR shortly. I'll also include some of the additional documentation linking to this cookbook article. |
Ok, ready for another review. I've made the changes you requested and added a cross-reference link from the element-level empty_data section. I didn't think it made sense to link from the form classes section. It didn't talk about |
@@ -11,3 +11,4 @@ Form | |||
create_custom_field_type | |||
create_form_type_extension | |||
use_virtuals_forms | |||
use_empty_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should add the newline at the end IMO to avoid extra diffs (and associated conflicts) when adding another line in the file
As there is nothing specific to the framework here, the Form component may be a better place than the cookbook. But it would also apply to the article about the virtual forms. @weaverryan what do you think ? |
single: Form; Empty data | ||
|
||
How to configure Empty Data for a Form Class | ||
=============================================== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some =
to much
@stof It's not always easy to write something that's useful that doesn't "couple" itself to the framework, but in this case, it's happened accidentally. Buuut, we don't have the form component yet. So I think the only thing to do is keep it in the cookbook and move things later on. |
Fixed the missing line break at end of file and the extra = under the heading. |
|
||
If you want to override this default behavior, there are two ways to do this. | ||
|
||
**Option 1**: instantiate a new class:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to use sections in the article?
Option 1: Instantiate a new Class
---------------------------------
One reason you might use option 1 [...]
.. code-block:: php
// ...
👍 |
new cookbook article on using empty data for form classes
Hi Joel! Really really wonderful work here - and it's such a nice topic. I've merged this into the 2.0 branch and added some additional examples at sha: 87c0536. Please let me know if you see anything you don't like (and excuse my User -> Post change, I started adding details then only later saw that you were using a User example - both are perfectly fine). I also merged this into the 2.1 branch and made the needed changes at sha: 0d62bfc Thanks Joel! |
The additions look nice! Thanks for the merge. |
I'd like some feedback on my cookbook article for both accuracy and formatting. I am working on linking this cookbook article from the form class section of the documentation, as well as the two form types (choice and collection) that use the empty_data option. Those are both relevant, correct?