VarDumperBlock.php in VarDumper 7
File
modules/vardumper_block/src/VarDumper/VarDumperBlock.php
View source
<?php
namespace Drupal\vardumper_block\VarDumper;
use Drupal\service_container\Legacy\Drupal7;
use Drupal\vardumper\VarDumper\VarDumperDebug;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
class VarDumperBlock extends VarDumperDebug {
protected $session;
protected $drupal7;
public function __construct(SessionInterface $session, Drupal7 $drupal7) {
$this->session = $session;
$this->drupal7 = $drupal7;
}
public function dump($var, $name = '') {
if (!$this
->hasPermission()) {
return;
}
$html = $this
->getHeaders($name, $this
->getDebugInformation()) . $this
->getDebug($var);
$this->session
->getFlashBag()
->add('vardumper', $html);
}
}