class Item

Same name in other branches
  1. 9 core/modules/aggregator/src/Entity/Item.php \Drupal\aggregator\Entity\Item
  2. 9 core/lib/Drupal/Core/Render/Element/Item.php \Drupal\Core\Render\Element\Item
  3. 8.9.x core/modules/aggregator/src/Entity/Item.php \Drupal\aggregator\Entity\Item
  4. 8.9.x core/lib/Drupal/Core/Render/Element/Item.php \Drupal\Core\Render\Element\Item
  5. 10 core/lib/Drupal/Core/Render/Element/Item.php \Drupal\Core\Render\Element\Item

Provides a display-only form element with an optional title and description.

Note: since this is a read-only field, setting the #required property will do nothing except theme the form element to look as if it were actually required (i.e. by placing a red star next to the #title).

Hierarchy

Expanded class hierarchy of Item

13 string references to 'Item'
config_test.schema.yml in core/modules/config/tests/config_test/config/schema/config_test.schema.yml
core/modules/config/tests/config_test/config/schema/config_test.schema.yml
ContentTranslationHandler::addTranslatabilityClue in core/modules/content_translation/src/ContentTranslationHandler.php
Adds a clue about the form element translatability.
FormBuilder::handleInputElement in core/lib/Drupal/Core/Form/FormBuilder.php
Adds the #name and #value properties of an input element before rendering.
JsonApiDocumentTopLevelNormalizer::normalizeOmissionsLinks in core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php
Normalizes omitted data into a set of omission links.
LinksetController::toLinkTargetObjects in core/modules/system/src/Controller/LinksetController.php
Encode a menu tree as link items and capture any cacheability metadata.

... See full list

File

core/lib/Drupal/Core/Render/Element/Item.php, line 14

Namespace

Drupal\Core\Render\Element
View source
class Item extends FormElementBase {
    
    /**
     * {@inheritdoc}
     */
    public function getInfo() {
        return [
            // Forms that show author fields to both anonymous and authenticated users
            // need to dynamically switch between #type 'textfield' and #type 'item'
            // to automatically take over the authenticated user's information.
            // Therefore, we allow #type 'item' to receive input, which is internally
            // assigned by Form API based on the #default_value or #value properties.
'#input' => TRUE,
            '#markup' => '',
            '#theme_wrappers' => [
                'form_element',
            ],
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
FormElementBase::processAutocomplete public static function Adds autocomplete functionality to elements. 1
FormElementBase::processPattern public static function #process callback for #pattern form element property. 1
FormElementBase::validatePattern public static function #element_validate callback for #pattern form element property. 1
FormElementBase::valueCallback public static function Overrides FormElementInterface::valueCallback 17
Item::getInfo public function Overrides ElementInterface::getInfo
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
RenderElementBase::preRenderAjaxForm public static function Adds Ajax information about an element to communicate with JavaScript. 2
RenderElementBase::preRenderGroup public static function Adds members of this group as actual elements for rendering. 2
RenderElementBase::processAjaxForm public static function Form element processing handler for the #ajax form property. 3
RenderElementBase::processGroup public static function Arranges elements into groups. 2
RenderElementBase::setAttributes public static function Overrides ElementInterface::setAttributes 2

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