function DevelDumperManager::exportAsRenderable

Same name and namespace in other branches
  1. 4.x src/DevelDumperManager.php \Drupal\devel\DevelDumperManager::exportAsRenderable()

Returns a render array representation of a variable.

Parameters

mixed $input: The variable to export.

string $name: The label to output before variable.

string $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, $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 [];
}