"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Core/Render/Element/Item.php" (26 Nov 2020, 986 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Item.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\Core\Render\Element;
    4 
    5 /**
    6  * Provides a display-only form element with an optional title and description.
    7  *
    8  * Note: since this is a read-only field, setting the #required property will do
    9  * nothing except theme the form element to look as if it were actually required
   10  * (i.e. by placing a red star next to the #title).
   11  *
   12  * @FormElement("item")
   13  */
   14 class Item extends FormElement {
   15 
   16   /**
   17    * {@inheritdoc}
   18    */
   19   public function getInfo() {
   20     return [
   21       // Forms that show author fields to both anonymous and authenticated users
   22       // need to dynamically switch between #type 'textfield' and #type 'item'
   23       // to automatically take over the authenticated user's information.
   24       // Therefore, we allow #type 'item' to receive input, which is internally
   25       // assigned by Form API based on the #default_value or #value properties.
   26       '#input' => TRUE,
   27       '#markup' => '',
   28       '#theme_wrappers' => ['form_element'],
   29     ];
   30   }
   31 
   32 }