DrupalVariable.php in Devel 8
File
src/Plugin/Devel/Dumper/DrupalVariable.php
View source
<?php
namespace Drupal\devel\Plugin\Devel\Dumper;
use Drupal\Component\Utility\Variable;
use Drupal\Component\Utility\Xss;
use Drupal\devel\DevelDumperBase;
class DrupalVariable extends DevelDumperBase {
public function export($input, $name = NULL) {
$name = $name ? $name . ' => ' : '';
$dump = Variable::export($input);
$dump = Xss::filterAdmin($dump);
$dump = '<pre>' . $name . $dump . '</pre>';
return $this
->setSafeMarkup($dump);
}
public function exportAsRenderable($input, $name = NULL) {
$output['container'] = [
'#type' => 'details',
'#title' => $name ?: $this
->t('Variable'),
'#attached' => [
'library' => [
'devel/devel',
],
],
'#attributes' => [
'class' => [
'container-inline',
'devel-dumper',
'devel-selectable',
],
],
'export' => [
'#markup' => $this
->export($input),
],
];
return $output;
}
public static function checkRequirements() {
return TRUE;
}
}