Skip to content
Snippets Groups Projects
Commit 78aba37b authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2486999 by metzlerd, er.pushpinderrana, jhodgdon: Create Documentation...

Issue #2486999 by metzlerd, er.pushpinderrana, jhodgdon: Create Documentation For Button Form Elements
parent af97e790
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -16,6 +16,23 @@
* When the button is pressed, the form will be submitted to Drupal, where it is
* validated and rebuilt. The submit handler is not invoked.
*
* Properties:
* - #limit_validation_errors: An array of form element keys that will block
* form submission when validation for these elements or any child elements
* fails. Specify an empty array to suppress all form validation errors.
* - #value: The text to be shown on the button.
*
*
* Usage Example:
* @code
* $form['actions']['preview'] = array(
* '#type' => 'button',
* '#value => $this->t('Preview'),
* );
* @endcode
*
* @see \Drupal\Core\Render\Element\Submit
*
* @FormElement("button")
*/
class Button extends FormElement {
......
......@@ -10,6 +10,36 @@
/**
* Provides a render element for a set of links rendered as a drop-down button.
*
* By default, this element sets #theme so that the 'links' theme hook is used
* for rendering, with suffixes so that themes can override this specifically
* without overriding all links theming. If the #subtype property is provided in
* your render array with value 'foo', #theme is set to links__dropbutton__foo;
* if not, it's links__dropbutton; both of these can be overridden by setting
* the #theme property in your render array. See template_preprocess_links()
* for documentation on the other properties used in theming; for instance, use
* element property #links to provide $variables['links'] for theming.
*
* Properties:
* - #links: An array of links to actions. See template_preprocess_links() for
* documentation the properties of links in this array.
*
* Usage Example:
* @code
* $form['actions']['extra_actions'] = array(
* '#type' => 'dropbutton',
* '#links' => array(
* 'simple_form' => array(
* 'title' => $this->t('Simple Form'),
* 'url' => Url::fromRoute('fapi_example.simple_form'),
* ),
* 'demo' => array(
* 'title' => $this->t('Build Demo'),
* 'url' => Url::fromRoute('fapi_example.build_demo'),
* ),
* ),
* );
* @endcode
*
* @see \Drupal\Core\Render\Element\Operations
*
* @RenderElement("dropbutton")
......
......@@ -14,6 +14,8 @@
* difference is that it offers themes the possibility to render it differently
* through a theme suggestion.
*
* @see \Drupal|Core\Render\Element\DropButton
*
* @RenderElement("operations")
*/
class Operations extends Dropbutton {
......
......@@ -13,6 +13,22 @@
* Submit buttons are processed the same as regular buttons, except they trigger
* the form's submit handler.
*
* Properties:
* - #submit: Specifies an alternate callback for form submission when the
* submit button is pressed. Use '::methodName' format or an array containing
* the object and method name (for example, [ $this, 'methodName'] ).
* - #value: The text to be shown on the button.
*
* Usage Example:
* @code
* $form['actions']['submit'] = array(
* '#type' => 'submit,
* '#value' => $this->t('Save'),
* );
* @endcode
*
* @see \Drupal\Core\Render\Element\Button
*
* @FormElement("submit")
*/
class Submit extends Button {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment