function EntityDebugController::entityLoad
Same name in other branches
- 4.x src/Controller/EntityDebugController.php \Drupal\devel\Controller\EntityDebugController::entityLoad()
- 5.x src/Controller/EntityDebugController.php \Drupal\devel\Controller\EntityDebugController::entityLoad()
Returns the loaded structure of the current entity.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: A RouteMatch object.
Return value
array Array of page elements to render.
File
-
src/
Controller/ EntityDebugController.php, line 74
Class
- EntityDebugController
- Controller for devel entity debug.
Namespace
Drupal\devel\ControllerCode
public function entityLoad(RouteMatchInterface $route_match) {
$output = [];
$entity = $this->getEntityFromRouteMatch($route_match);
if ($entity instanceof EntityInterface) {
// Field definitions are lazy loaded and are populated only when needed.
// By calling ::getFieldDefinitions() we are sure that field definitions
// are populated and available in the dump output.
// @see https://www.drupal.org/node/2311557
if ($entity instanceof FieldableEntityInterface) {
$entity->getFieldDefinitions();
}
$output = $this->dumper
->exportAsRenderable($entity);
}
return $output;
}