class Value

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

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:

$form['entity_id'] = array(
    '#type' => 'value',
    '#value' => $entity_id,
);

Plugin annotation

@FormElement("value");

Hierarchy

Expanded class hierarchy of Value

355 string references to 'Value'
AccessManagerTest::testCheckNamedRouteWithDefaultValue in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests the checkNamedRoute with default values.
AccessManagerTest::testCheckNamedRouteWithUpcastedValues in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests the checkNamedRoute with upcasted values.
AjaxCommandsTest::testDataCommand in core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php
@covers \Drupal\Core\Ajax\DataCommand
AjaxCommandsTest::testSettingsCommand in core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php
@covers \Drupal\Core\Ajax\SettingsCommand
AssertLegacyTrait::assertFieldsByValue in core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
Asserts that a field exists in the current page with a given Xpath result.

... See full list

55 #type uses of Value
ActionFormBase::form in core/modules/action/src/Form/ActionFormBase.php
Gets the actual form array to be built.
BlockForm::form in core/modules/block/src/BlockForm.php
Gets the actual form array to be built.
BlockInterfaceTest::testBlockInterface in core/modules/block/tests/src/Kernel/BlockInterfaceTest.php
Tests configuration and subsequent form() and build() method calls.
BlockPluginTrait::buildConfigurationForm in core/lib/Drupal/Core/Block/BlockPluginTrait.php
Creates a generic configuration form for all block types. Individual block plugins can add elements to this form by overriding BlockBase::blockForm(). Most block plugins should not override this method unless they need to alter the generic form elements.
BookAdminEditForm::bookAdminTable in core/modules/book/src/Form/BookAdminEditForm.php
Builds the table portion of the form for the book administration page.

... See full list

File

core/lib/Drupal/Core/Render/Element/Value.php, line 22

Namespace

Drupal\Core\Render\Element
View source
class Value extends FormElement {
    
    /**
     * {@inheritdoc}
     */
    public function getInfo() {
        return [
            '#input' => TRUE,
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
FormElement::processAutocomplete public static function Adds autocomplete functionality to elements.
FormElement::processPattern public static function #process callback for #pattern form element property.
FormElement::validatePattern public static function #element_validate callback for #pattern form element property.
FormElement::valueCallback public static function Determines how user input is mapped to an element's #value property. Overrides FormElementInterface::valueCallback 16
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 6
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
RenderElement::preRenderAjaxForm public static function Adds Ajax information about an element to communicate with JavaScript.
RenderElement::preRenderGroup public static function Adds members of this group as actual elements for rendering.
RenderElement::processAjaxForm public static function Form element processing handler for the #ajax form property. 1
RenderElement::processGroup public static function Arranges elements into groups.
RenderElement::setAttributes public static function Sets a form element's class attribute. Overrides ElementInterface::setAttributes
Value::getInfo public function Returns the element properties for this element. Overrides ElementInterface::getInfo

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