VarDumperBlock.php in VarDumper 8
Same filename in this branch
Same filename and directory in other branches
Namespace
Drupal\vardumper_block\VarDumperFile
modules/vardumper_block/src/VarDumper/VarDumperBlock.phpView source
<?php
namespace Drupal\vardumper_block\VarDumper;
use Drupal\Core\Render\Markup;
use Drupal\vardumper\VarDumper\VarDumperDebug;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
* The VarDumperBlock class.
*/
class VarDumperBlock extends VarDumperDebug {
/**
* The Session service.
*
* @var Session
*/
protected $session;
/**
* {@inheritdoc}.
*/
public function __construct(SessionInterface $session) {
$this->session = $session;
}
/**
* {@inheritdoc}.
*/
public function dump($var, $name = '') {
if (!$this
->hasPermission()) {
return;
}
$html = $this
->getHeaders($name, $this
->getDebugInformation()) . $this
->getDebug($var);
$this->session
->getFlashBag()
->add('vardumper', Markup::create($html));
}
}
Classes
Name | Description |
---|---|
VarDumperBlock | The VarDumperBlock class. |