You are here

class VarDumperBlock in VarDumper 7

Same name and namespace in other branches
  1. 8 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 16
Contains Drupal\vardumper_block\VarDumper\VarDumperBlock.

Namespace

Drupal\vardumper_block\VarDumper
View source
class VarDumperBlock extends VarDumperDebug {

  /**
   * The Session service.
   *
   * @var Session;
   */
  protected $session;

  /**
   * The Drupal7 legacy service.
   *
   * @var \Drupal\service_container\Legacy\Drupal7
   */
  protected $drupal7;

  /**
   * {@inheritdoc}
   */
  public function __construct(SessionInterface $session, Drupal7 $drupal7) {
    $this->session = $session;
    $this->drupal7 = $drupal7;
  }

  /**
   * {@inheritdoc}
   */
  public function dump($var, $name = '') {
    if (!$this
      ->hasPermission()) {
      return;
    }
    $html = $this
      ->getHeaders($name, $this
      ->getDebugInformation()) . $this
      ->getDebug($var);
    $this->session
      ->getFlashBag()
      ->add('vardumper', $html);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
VarDumperBlock::$drupal7 protected property The Drupal7 legacy service.
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