Generic.php

Namespace

Drupal\Core\Render\Element

File

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

View source
<?php

namespace Drupal\Core\Render\Element;

use Drupal\Core\Render\Attribute\RenderElement;

/**
 * Provides a generic, empty element.
 *
 * Manually creating this element is not necessary; however, the system
 * often needs to convert render arrays that do not have a type. While
 * arrays without a #type are valid PHP code, it is not possible to create
 * an object without a class.
 */
class Generic extends RenderElementBase {
  
  /**
   * {@inheritdoc}
   */
  public function getInfo() {
    return [];
  }
  
  /**
   * {@inheritdoc}
   */
  protected function setType() : void {
  }

}

Classes

Title Deprecated Summary
Generic Provides a generic, empty element.

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