Form generation example does not use correct standard for submit

Created on 18 July 2012, over 12 years ago
Updated 18 August 2024, 4 months ago

Problem/Motivation

  1. 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".

  2. it is recommended to use [] instead of array() 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

📌 Task
Status

Closed: outdated

Version

11.0 🔥

Component
Documentation 

Last updated 1 day ago

No maintainer
Created by

🇺🇸United States vegantriathlete Lakewood, CO

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024