Problem/Motivation
- Originally reported for http://api.drupal.org/api/drupal/includes%21form.inc/group/form_api/7. The documentation is now in core.api.php, https://api.drupal.org/api/drupal/core%21core.api.php/group/form_api/10.0.x.
I've hunted around a bit and can't find the "standard" for this. But, I believe the correct way is supposed to be:
BTW, it would be great if you could include the link to the standard in the comment that marks this issue as "fixed".
- it is recommended to use
[]instead ofarray()in Drupal 9 code for creating arrays. This helps to make the code more readable and concise. so need to replace those as syntax is shorter and more concise, and therefore it is often preferred
Steps to reproduce
Proposed resolution
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => t('Submit'),
];
Remaining tasks
Patch
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-1691688
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 1691688-form-generation-example
changes, plain diff MR !3020
Comments
Comment #1
jhodgdonYou are correct, that example should be updated, and I'm not sure where the standards are for putting the submit button in an "actions" wrapper.
Comment #13
quietone commentedTriaged at a documentation triage meeting in #documentation.
This is still valid. I search for and did not find any duplicates. I think this is suitable as a first time issue, adding 'novice' tag.
Comment #16
sahal_va commentedComment #17
smustgrave commentedThink this change should be fine.
Comment #18
bnjmnmThere are several changes in the MR that are out of scope from what is stated in the issue summary. This could be addressed by reducing the scope of the changes or by broadening the requirements in the issue summary.
Comment #19
sahil.goyal commentedpatch #15 is looks good, as per #18 it is getting out of scope of IS, so i updated the Issue summary so it cover up to other out of scope changes mentioned in #18.
RTBC+1
Comment #22
quietone commentedThanks for working on this!
This was fixed in issue #2874067: Fix Drupal.Commenting.DocCommentLongArraySyntax coding standard, so closing this as outdated.