You are here

class VarDumperBlock in VarDumper 8

Same name in this branch
  1. 8 modules/vardumper_block/src/VarDumper/VarDumperBlock.php \Drupal\vardumper_block\VarDumper\VarDumperBlock
  2. 8 modules/vardumper_block/src/Plugin/Block/VarDumperBlock.php \Drupal\vardumper_block\Plugin\Block\VarDumperBlock
Same name and namespace in other branches
  1. 7 modules/vardumper_block/src/VarDumper/VarDumperBlock.php \Drupal\vardumper_block\VarDumper\VarDumperBlock

The VarDumperBlock class.

Hierarchy

Expanded class hierarchy of VarDumperBlock

1 string reference to 'VarDumperBlock'
vardumper_block.services.yml in modules/vardumper_block/vardumper_block.services.yml
modules/vardumper_block/vardumper_block.services.yml
1 service uses VarDumperBlock
vardumper_block in modules/vardumper_block/vardumper_block.services.yml
\Drupal\vardumper_block\VarDumper\VarDumperBlock

File

modules/vardumper_block/src/VarDumper/VarDumperBlock.php, line 12

Namespace

Drupal\vardumper_block\VarDumper
View source
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));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
VarDumperBlock::$session protected property The Session service.
VarDumperBlock::dump public function .
VarDumperBlock::__construct public function .
VarDumperDebug::$header1 protected property
VarDumperDebug::$header2 protected property
VarDumperDebug::getDebug public function
VarDumperDebug::getDebugInformation public function
VarDumperDebug::getHeaders public function
VarDumperDebug::hasPermission public function