function ElementInfoController::elementDetail

Same name in other branches
  1. 5.x src/Controller/ElementInfoController.php \Drupal\devel\Controller\ElementInfoController::elementDetail()

Returns a render array representation of the element.

Parameters

string $element_name: The name of the element to retrieve.

Return value

array A render array containing the element.

Throws

\Symfony\Component\HttpKernel\Exception\NotFoundHttpException If the requested element is not defined.

1 string reference to 'ElementInfoController::elementDetail'
devel.routing.yml in ./devel.routing.yml
devel.routing.yml

File

src/Controller/ElementInfoController.php, line 136

Class

ElementInfoController
Provides route responses for the element info page.

Namespace

Drupal\devel\Controller

Code

public function elementDetail($element_name) {
    if (!($element = $this->elementInfo
        ->getDefinition($element_name, FALSE))) {
        throw new NotFoundHttpException();
    }
    $element += $this->elementInfo
        ->getInfo($element_name);
    return $this->dumper
        ->exportAsRenderable($element, $element_name);
}