You are here

public function AvailableTestDumper::exportAsRenderable in Devel 4.x

Same name and namespace in other branches
  1. 8.3 tests/modules/devel_dumper_test/src/Plugin/Devel/Dumper/AvailableTestDumper.php \Drupal\devel_dumper_test\Plugin\Devel\Dumper\AvailableTestDumper::exportAsRenderable()
  2. 8 tests/modules/devel_dumper_test/src/Plugin/Devel/Dumper/AvailableTestDumper.php \Drupal\devel_dumper_test\Plugin\Devel\Dumper\AvailableTestDumper::exportAsRenderable()
  3. 8.2 tests/modules/devel_dumper_test/src/Plugin/Devel/Dumper/AvailableTestDumper.php \Drupal\devel_dumper_test\Plugin\Devel\Dumper\AvailableTestDumper::exportAsRenderable()

Returns a string representation of a variable wrapped in a render array.

Parameters

mixed $input: The variable to export.

string $name: (optional) The label to output before variable, defaults to NULL.

Return value

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

Overrides DevelDumperBase::exportAsRenderable

File

tests/modules/devel_dumper_test/src/Plugin/Devel/Dumper/AvailableTestDumper.php, line 41

Class

AvailableTestDumper
Provides a AvailableTestDumper plugin.

Namespace

Drupal\devel_dumper_test\Plugin\Devel\Dumper

Code

public function exportAsRenderable($input, $name = NULL) {

  // Add a predetermined string to $input to check if this dumper has been
  // selected successfully.
  $input = '<pre>' . 'AvailableTestDumper::exportAsRenderable() ' . $input . '</pre>';
  return [
    '#attached' => [
      'library' => [
        'devel_dumper_test/devel_dumper_test',
      ],
    ],
    '#markup' => $this
      ->setSafeMarkup($input),
  ];
}