-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add missing options, add method arguments lists with descriptions, examples and definitions #4598
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
Add the default widget templates into beginning of Creating Form Inputs subsection to make it clear right away what HTML the method generates; Small formatting improvements from start of page up to Creating Input Elements section, for better readability of small code elements.
Add note in Creating Form Inputs section to remind that input method generates wrapping divs. Add small formatting in the same section - wrap in code tags all pure text element or method names to make page consistent with itself Disambiguate and/or clarify small phrase parts in the same section.
Disambiguate the initial description of Common Options; the options with go in either $options or $attributes array, depending on the chosen method; Eliminate '$options' from the name of each option entry in the description to avoid confusion; Reformat element/option names or values with code tags to follow general style of the page and improve readability; Rephrase/clarify some unclear wording up to Creating Input Elements section.
Add code formatting tags on element, key, value, method names where missing, from beginning of "Creating Input Elements" up to beginning of "Creating Buttons and Submit Elements"; Add missing examples in the same area of document; Correct/disambiguate some explanations in the same area of document; Add the list of arguments with short description right after the method name in each subsection; Add (where existent) the widget template at beginning of method description to make clear what HTML is output.
Add after each method arguments under each method name with short description for each argument from the beginning of "Creating Buttons and Submit Elements" until beginning of "Creating Inputs for Associated Data"; Add missing examples in various places in the same document area; Format element, attribute, key, property names with code tags to improve readability and page consistency;
Add line breaks in the note present inside Creating Form Inputs
Reformat long lines that don't contain code to fit into 80 chars. Add more detailed description for secure(), from source code description. Fix few small spell-checking errors. Add arguments description for methods in the last part of page starting from Creating Inputs for Associated data till the end of page.
Reformat own added/modified text to fit the 80 chars limtit. Correct own description of fieldname in date/time related methods. Reword Input Options descriptions to keep current definition but start by option type specification. Indent all example/output code block pairs to allow faster scanning of page sections and differentiation from definitions/descriptions in long option lists. Add missing Input Options: 'options', 'nestedInput' and 'templates' along with descriptions from source code API comments. Create section for Select, Checkbox and Radio and move their specific options into that section. Add missing explanations on how 'value' option behaves on checkbox and radio buttons and how 'empty' behaves on radio buttons based on source code API comments. Create section for DateTime controls and move their specific options into that section; transform each date/time method section into subsection. Move all common options for date/time from each date and time method into the beginning of DateTime section and split in Options for Date and Options for Time. Add missing date/time options in the Date Options and Time options sub-sections from source code API comments. Improve and explanations for time/date-related options based on comments of source code API. Improve descriptions for certain time/date-related methods based on comments of source code API. Add example for dateTime() default method output. Add missing date() method with arguments description, definition and example based on API source code. Add ref links from each date and time method arguments description towards the commong datetime options subsection and respectively date-options or time-options subsections. Transform textual note at end of Creating Month Inputs into reST note. Add example output for minutes interval example in Creating Minute Inputs. Add, inside Displaying and Checking Errors, subsections for Displaying Errors and Checking for Errors to allow easier identification and direct navigation from TOC. Improve arguments description for error() based on API source code comments. Improve description for error() and add reST tip about using validator rules error messages when the same custom message is desired. Create subsections inside Creating Buttons and Submit elements: Creating Submit Elements and Creating Button Elements to allow easier finding of each method via TOC. Expand definition in Creating Submit Elements sub-section based on API source-code comments. Add note about additional options provided to Submit being passed to input element if not recognized as submit-specific. Create subsections inside Creating Standalong Buttons and POST Links: Creating POST Buttons and Creating POST Links to allow easier finding each method via TOC. Add subsections inside Generating Entire Forms: Creating Multiple Inputs and Creating Inputs for a Whole Entity to allow easier finding of each method via TOC. Change last example inside inputs() method to use the actual method instead of allInputs(). Small improvements in text description in multiple places on the page.
Change "next" with "a following" in Starting a Form, as the section referring to Context doesn't come first after that paragraph Add empty lines between $model built-in providers enumeration to improve readability Add links to context provider classes in each enumeration Add new sub-section in Starting a Form, named Options for Form, which contains the valid options for create() method
Fix indenting for some notes.
…ds original Small indenting fixes.
…ting Form Inputs Expand explanation in the introduction for autodetected datatypes in Creating Form Inputs Fix own indentation mistakes Fix own small ortography mistakes Add <option> template at beginning of Create Select Pickers Add optional templates at beginning of Create Select Pickers Add specification about checkboxes created via input() in Moving Checkboxes and Radios Outside of a Label
Consolidation commit before pull request: Add code tags around names of: methods, arguments, attributes, options, HTML elements, where missing. Add argument list with description for each method on the page Add list of used templates after method description, in all method where it applies. Add Form::create() options list with description in new subsection Add missing options in options list for: input() and add details in some option definitions. Reword Input Options descriptions to keep current definition but start by option type specification. Clarify in introduction of Common Options for Specific Inputs that the options will be provided either in $options or in $attributes depending on the method Create subsection for Checkbox, Select and Radio and move common Options for Select, Checkbox and Radio at beginning of that subsection for easier reference. Clarify in Options for Select, Checkbox and Radio when 'value' and 'empty' will do for each method Indent code block examples inside all options lists, one level further, in order to allow faster and easier scan of the list and differentiation between definitions/descriptions and examples. Create subsection for Date & Time controls and move common Options for Date & Time at beginning of this subsection for easier reference. Separate Options for Date & Time in 3 sub-subsections: Common Options for Date & Time, Options for Date and Options for Time Add missing Date & Time options from API source code comments, along with explanations. Add missing date() method subsection inside the Date & Time section along with example. Improve explanations of Date & Time options based on comments in API source code. Add ref links from each Date & Time method arguments description towards: common input options, common datetime options and respectively common date or time options (depending on method). Transform textual note at the end of Creating Month Inputs into reST note. Add example output for minutes interval example code, in Creating Minute Inputs. Regroup options specific to any one particular method inside a list in the method's section; easier to identify and skim through. Add 2 subsections inside Displaying and Checking errors; one for each method for easier reference from TOC. Create 2 subsections inside Creating Buttons and Submit Elements: one for submits and one for buttons; allows easier access from TOC. Create 2 subsections inside Creating Standalone Buttons and POST Links; allows easier access from TOC. Create 2 subsections inside Generating Entire Forms: allows easier access from TOC. Add reST note about additional options passed to Submit, being passed to the input element. Elaborate definition in Creating Submit Elements subsection, based on API source-code comments. Change last example code block inside inputs() method to use the actual method instead of allInputs(). Add reST note in Creating Form Inputs to remind that elements generated by input() are always wrapped in divs. Elaborate description for error() and add reST tip about use of validator messages. Improve and expand some definitions and explanations across page, based on detailed comments from API source code. Expand explanation introducing the autodetected datatypes in Creating Form Inputs. Add links to context provider classes in API from each entry in the list of built-in context providers in Starting a Form section. Clarify in Moving Checkboxes and Radios Outside of a Label that only checkboxes created via input() are wrapped in a label. Add details about radio button creation methods in Moving Checkboxes and Radios Outside of a Label
markstory
left a comment
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.
Thank you for the changes. The extra detail will be helpful for lots of folks.
In the future, I would recommend you make these kinds of changes in smaller pieces, as very large pull requests are time consuming to create, review, and land.
en/views/helpers/form.rst
Outdated
| ``$model``: | ||
|
|
||
| * An ``Entity`` instance or an iterator will map to | ||
| `EntityContext <https://api.cakephp.org/3.3/class-Cake.View.Form.EntityContext.html>`; |
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're missing _ on the end of this link.
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.
Fixed in current commit.
en/views/helpers/form.rst
Outdated
| built-in ORM. | ||
|
|
||
| * An array containing the ``'schema'`` key, will map to | ||
| `ArrayContext <https://api.cakephp.org/3.3/class-Cake.View.Form.ArrayContext.html>` |
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.
And this one.
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.
Fixed in current commit.
en/views/helpers/form.rst
Outdated
| which allows you to create simple data structures to build forms against. | ||
|
|
||
| * ``null`` and ``false`` will map to | ||
| ``NullContext <https://api.cakephp.org/3.3/class-Cake.View.Form.NullContext.html>``; |
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.
This link is also incorrect.
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.
Fixed in current commit.
en/views/helpers/form.rst
Outdated
| override the default HTTP method. | ||
|
|
||
| Options for Form |
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.
Should this mention its for form creation
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.
Fixed in current commit.
en/views/helpers/form.rst
Outdated
|
|
||
| Changing the HTTP Method for a Form | ||
| ----------------------------------- | ||
|
|
||
| By using the ``type`` option you can change the HTTP method a form will use:: | ||
| By using the ``'type'`` option you can change the HTTP method a form will use:: |
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.
We don't generally include single quotes around key name as the inline code indicates that it is a key name.
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've removed the quotes around this word as indicated.
I think I've added quotes around pretty much around every key name; if I understand correctly I should remove them everywhere, right?
As a more particular case, should I remove them even in the enumeration lists (i.e. where we show a list of all the available key names, with their description; I'm asking that since in those places I guess they are meant to indicate what we should literally input in our code and might be helpful to leave no room for guessing for beginners.
My rationale for adding them was that some trivial key names such "type", "empty", "default", "value" etc. coincide with standard vocabulary words as well as with certain HTML attributes and I thought it would help disambiguate what we refer to, since it certain phrase constructions it can become fuzzy to tell what the author's intended meaning is (it might be more obvious for a veteran Cake user, but then again, they're not the main target audience of the manual as they need it less ).
Of course, if you think they need to go away, everywhere, I'll remove them all over the page where code examples aren't involved. Just making sure what I should do, for now.
en/views/helpers/form.rst
Outdated
| will be used as a class name:: | ||
| When you set ``$options`` to a string it will be used as a class name: | ||
|
|
||
| :: |
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.
This should be folded with the line above.
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.
Fixed in current commit.
en/views/helpers/form.rst
Outdated
|
|
||
| For example:: | ||
|
|
||
| // In Templates/Tickets/index.ctp |
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.
This needs to be indented in a multiple of 4.
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.
Fixed in current commit.
en/views/helpers/form.rst
Outdated
|
|
||
| .. code-block:: html | ||
|
|
||
| <form method="post" accept-charset="utf-8" action="/Rtools/tickets/delete/5"> |
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.
This needs to be indented in a multiple of 4.
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.
Fixed in current commit.
en/views/helpers/form.rst
Outdated
| echo $this->Form->input('password', [ | ||
| 'templateVars' => ['help' => 'At least 8 characters long.'] | ||
| ]); | ||
| // Add a template with the help placeholder. |
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.
This needs to be indented in a multiple of 4.
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.
Fixed in current commit.
en/views/helpers/form.rst
Outdated
|
|
||
| .. code-block:: html | ||
|
|
||
| <div class="input password"> |
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.
This needs to be indented in a multiple of 4.
Fix broken reST hyperlinks in Starting a Form section and for the wikipedia link. Change subsection title to Options for Form Creation. Remove quotes on 'type' key name in Changing the HTTP Method for Form section. Capitalize Modelname.fieldname across the whole page. Fix indenting of code block examples to always follow 4 spaces multiples in respect to page left margin or in respect to the paragraph hanging indent (when inside enumeration lists). Fix 2 other small formattings in the text.
|
Thanks @markstory for all the feedback; I know how tedious it can be to review somebody else's work. Your suggestion about smaller chunks of updates, was also duly noted. :) I've fixed pretty much all that was indicated, in the current commit, save for the 2 questions, about quotes and code extra indentation inside enum lists; where I'll need your feedback, when you can find the time, in order to get it right. |
|
Will that easily merge with #4559 ? Edit: Thanks for doing this. I bit the bullet with too big PRs multiple times, but nevertheless this is very nice work. |
|
@admusin you'll have to solve the conflicts for this to be mergeable. |
|
I'Lloyd try to review it tonight or tomorrow also... |
|
I've solved the conflicts and committed the solved version. |
|
@admusin I can't find the 2 questions you asked. Where are they? |
|
Hi @markstory , They are in the answers I wrote under your comments. Since now they display as "outdated", I suppose they're not popping up so much anymore and are easy to miss. First:
Second:
|
|
For point 1 I'm not sure if it was mentioned before but I would suggest that you go with smaller changes for next contribution, to help review AND translators work. |
en/views/helpers/form.rst
Outdated
| If you use a certain model field to generate multiple form fields via | ||
| ``input()``, and you want the same validation error message displayed for | ||
| each one, you will probably be better off defining a custom error message | ||
| inside the respective :ref:`validator rules<create-validators>`. |
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.
this label doesn't seems to exist and causes the build to break
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.
@antograssiot , thanks for the feedback.
Yes, I've just realized that it's mistyped; the real label is "creating-validators".
I will fix it.
So, for the point above (about the quotes) what should I do in the end? I'm a bit fuzzy now, after your edit of your initial comment. :)
Indeed, one of the reasons why I went ahead and added them where they were missing, was the fact that they were already used in the document, on similar words (attribute names, element names, key names etc.) but not in a consistent fashion. So, I was trying to at least make the whole page look the same, not have the same word some times in quotes and some others not.
One other reason is that in most browsers, the simple back ticks yield a pretty mild result (they only change the font) but, visually, the results is not very easy to pick up so they might be missed. On top of that, if you have a word that is surrounded by quotes but not backticks, in the final result your straight quotes will be converted to curly quotes which kind of "alters" a bit their meaning; we tend to assume straight quotes exemplify a value as it should appear in code (e.g. a key name) whereas curly quotes might just mean you want to emphasize or cite something. But it might be just me.
Anyways, in short, if you guys think they should really go away, I can parse the whole page and eliminate them - I mean, even the ones that were already on the page - (save for code samples, of course), or else let me know.
| ``$model``: | ||
|
|
||
| * An ``Entity`` instance or an iterator will map to | ||
| `EntityContext <https://api.cakephp.org/3.3/class-Cake.View.Form.EntityContext.html>`_; |
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.
including those kind of links like that is a bad idea and will get outdated really quickly
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.
We already have, since quite a while, on this page, a link to the API, inside the List Of Templates section. To be frank I found and still find it highly valuable, as I recently used it quite often. It's true it still points to the 3.2 version of the documentation but that part didn't seem to change in 3.3.
The thing is, that the enumeration list in the beginning of the page, as it is now, is of too little use to any first-comer without any pointer towards those classes; you won't know where these classes are.
In fact it's not obvious at first view even that they are classes for that matter; when I first arrived on the page I couldn't make heads or tails of this list and figured out that it's referring internal classes, from the small hint in the text of the 3rd option which is null, and then it took me a bit of search to actually find them.
The list tells us even less on what kind of options/arguments we could use to customize them.
The whole point of the links was to help other users avoid this hurdle and land on the corresponding API page then figure it out, themselves, from there, if needed.
I understand the argument about the API code maybe being changed in the future and the link becoming a bit stale; but I would argue that a user savvy enough to start creating custom contexts, will know to search for the last version of the API, starting from the corresponding page where s/he lands.
On the other hand if the API changes that much that these classes are completely removed or change names this section of the page will be probably rewritten anyways.
If you're adamant about removing them, I will, though.
Don't we have any other means of linking towards an API chapter where the link will seamlessly "migrate" along with the new API versions (let's say, as long as the "target section" API name doesn't change, even though its absolute URL might) ?
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.
If we're linking to the API docs, do we need to duplicate all the options here? Seems redundant and makes the documentation harder to maintain, as we'll need to update both the links and options as they change.
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.
@markstory
I've only added the options pertaining to Form Helper.
I didn't add any of the options that can be fed into the entity classes (that's why I added the links to their API pages) as I was thinking it may be too much. Just wanted to provide some doorway for anybody interested to know more about the entities, hence the added links.
Do you suggest that we should remove the links and enumerate the options of each entity instead? Or just simply drop the links?
As I said, I'm not against modifying the file and in the end I'll do what you guys request to make it fit neatly with the rest of the docs.
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.
Given that the contexts don't have an book docs (as its not something the lay person has to interact with direclty) perhaps an API link is reasonable.
en/views/helpers/form.rst
Outdated
| provided then it will be autodetected based on the form context. | ||
| Valid values: | ||
|
|
||
| #. ``'get'`` - Will set the form method to HTTP GET. |
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.
not sure that we need an ordered list here
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're right, I'll change that.
en/views/helpers/form.rst
Outdated
|
|
||
| .. code-block:: html | ||
| Will output: |
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.
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.
Will do.
antograssiot
left a comment
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.
All extra text indentation and links to the api must be removed IMO
|
And yes, Mark already mentioned to me about submitting smaller chunks of changes in pull requests as they're easier to review and merge and I agree. I can see better now, how this may trigger too many back and forth comments for a single request. |
|
@admusin In general, try to make smaller chunks for PRs in the future. This will help to merge things faster. So are we OK with those improvements as they stand currently? |
|
@markstory We're talking about the quotes around some words. To summarize:
What I had done in the beginning was:
Rationale
In summary, hoping to clarify things I've used:
Now, depending on what your own thoughts and preferences are (even if they're completely different from the above), I'll modify the page accordingly; just let me know how you'd like to format each of the 3 cases above. |
|
Hi @dereuromark, sorry, I think I was writing my post above just in the meantime with yours. Once I know what you guys thinks is the better way to go about this, I'll make sure it gets that way and then it will be ready, from my point of view. |
|
Is there anything missing or good to go? //CC @markstory |



Add code tags around names of: methods, arguments, attributes, options, HTML elements, where missing.
Add argument list with description for each method on the page
Add list of used templates after method description, in all method where it applies.
Add Form::create() options list with description in new subsection
Add missing options in options list for: input() and add details in some option definitions.
Reword Input Options descriptions to keep current definition but start by option type specification.
Clarify in introduction of Common Options for Specific Inputs that the options will be provided either in $options or in $attributes depending on the method
Create subsection for Checkbox, Select and Radio and move common Options for Select, Checkbox and Radio at beginning of that subsection for easier reference.
Clarify in Options for Select, Checkbox and Radio when 'value' and 'empty' will do for each method
Indent code block examples inside all options lists, one level further, in order to allow faster and easier scan of the list and differentiation between definitions/descriptions and examples.
Create subsection for Date & Time controls and move common Options for Date & Time at beginning of this subsection for easier reference.
Separate Options for Date & Time in 3 sub-subsections: Common Options for Date & Time, Options for Date and Options for Time
Add missing Date & Time options from API source code comments, along with explanations.
Add missing date() method subsection inside the Date & Time section along with example.
Improve explanations of Date & Time options based on comments in API source code.
Add ref links from each Date & Time method arguments description towards: common input options, common datetime options and respectively common date or time options (depending on method).
Transform textual note at the end of Creating Month Inputs into reST note.
Add example output for minutes interval example code, in Creating Minute Inputs.
Regroup options specific to any one particular method inside a list in the method's section; easier to identify and skim through.
Add 2 subsections inside Displaying and Checking errors; one for each method for easier reference from TOC.
Create 2 subsections inside Creating Buttons and Submit Elements: one for submits and one for buttons; allows easier access from TOC.
Create 2 subsections inside Creating Standalone Buttons and POST Links; allows easier access from TOC.
Create 2 subsections inside Generating Entire Forms: allows easier access from TOC.
Add reST note about additional options passed to Submit, being passed to the input element.
Elaborate definition in Creating Submit Elements subsection, based on API source-code comments.
Change last example code block inside inputs() method to use the actual method instead of allInputs().
Add reST note in Creating Form Inputs to remind that elements generated by input() are always wrapped in divs.
Elaborate description for error() and add reST tip about use of validator messages.
Improve and expand some definitions and explanations across page, based on detailed comments from API source code.
Expand explanation introducing the autodetected datatypes in Creating Form Inputs.
Add links to context provider classes in API from each entry in the list of built-in context providers in Starting a Form section.
Clarify in Moving Checkboxes and Radios Outside of a Label that only checkboxes created via input() are wrapped in a label.
Add details about radio button creation methods in Moving Checkboxes and Radios Outside of a Label