class Item

Same name in this branch
  1. 9 core/modules/aggregator/src/Entity/Item.php \Drupal\aggregator\Entity\Item
Same name in other branches
  1. 8.9.x core/modules/aggregator/src/Entity/Item.php \Drupal\aggregator\Entity\Item
  2. 8.9.x core/lib/Drupal/Core/Render/Element/Item.php \Drupal\Core\Render\Element\Item
  3. 10 core/lib/Drupal/Core/Render/Element/Item.php \Drupal\Core\Render\Element\Item
  4. 11.x 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).

Plugin annotation

@FormElement("item");

Hierarchy

Expanded class hierarchy of Item

11 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.
FormHelper::processStates in core/lib/Drupal/Core/Form/FormHelper.php
Adds JavaScript to change the state of an element based on another element.
JsonApiDocumentTopLevelNormalizer::normalizeOmissionsLinks in core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php
Normalizes omitted data into a set of omission links.

... See full list

45 #type uses of Item
AddFormBase::buildEntityFormElement in core/modules/media_library/src/Form/AddFormBase.php
Builds the sub-form for setting required fields on a new media item.
AddHandler::buildForm in core/modules/views_ui/src/Form/Ajax/AddHandler.php
Form constructor.
AjaxTestImageEffect::ajaxCallback in core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/AjaxTestImageEffect.php
AJAX callback.
AjaxTestImageEffect::buildConfigurationForm in core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/AjaxTestImageEffect.php
ArgumentPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Provide a form to edit options for this plugin.

... See full list

File

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

Namespace

Drupal\Core\Render\Element
View source
class Item extends FormElement {
    
    /**
     * {@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
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
Item::getInfo public function Returns the element properties for this element. 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
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

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