Value.php

Same filename in other branches
  1. 8.9.x core/lib/Drupal/Core/Render/Element/Value.php
  2. 10 core/lib/Drupal/Core/Render/Element/Value.php
  3. 11.x core/lib/Drupal/Core/Render/Element/Value.php

Namespace

Drupal\Core\Render\Element

File

core/lib/Drupal/Core/Render/Element/Value.php

View source
<?php

namespace Drupal\Core\Render\Element;


/**
 * Provides a form element for storage of internal information.
 *
 * Unlike \Drupal\Core\Render\Element\Hidden, this information is not sent to
 * the browser in a hidden form field, but only stored in the form array for use
 * in validation and submit processing.
 *
 * Properties:
 * - #value: The value of the form element that cannot be edited by the user.
 *
 * Usage Example:
 * @code
 * $form['entity_id'] = array('#type' => 'value', '#value' => $entity_id);
 * @endcode
 *
 * @FormElement("value")
 */
class Value extends FormElement {
    
    /**
     * {@inheritdoc}
     */
    public function getInfo() {
        return [
            '#input' => TRUE,
        ];
    }

}

Classes

Title Deprecated Summary
Value Provides a form element for storage of internal information.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.