function DevelDumperManager::exportAsRenderable

Returns a render array representation of a variable.

Parameters

mixed $input: The variable to export.

string|null $name: The label to output before variable.

string|null $plugin_id: The plugin ID.

bool $load_references: If the input is an entity, also load the referenced entities.

Return value

array String representation of a variable wrapped in a render array.

Overrides DevelDumperManagerInterface::exportAsRenderable

File

src/DevelDumperManager.php, line 170

Class

DevelDumperManager
Manager class for DevelDumper.

Namespace

Drupal\devel

Code

public function exportAsRenderable($input, ?string $name = NULL, $plugin_id = NULL, $load_references = FALSE) : array {
  if ($this->hasAccessToDevelInformation()) {
    if ($load_references && $input instanceof EntityInterface) {
      $input = $this->entityToArrayWithReferences($input);
    }
    return $this->createInstance($plugin_id)
      ->exportAsRenderable($input, $name);
  }
  return [];
}