You are here

public function ElementInfoController::elementDetail in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Controller/ElementInfoController.php \Drupal\devel\Controller\ElementInfoController::elementDetail()
  2. 8.2 src/Controller/ElementInfoController.php \Drupal\devel\Controller\ElementInfoController::elementDetail()
  3. 4.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 153

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);
}