You are here

protected function HtmlDrupalDumper::style in VarDumper 8

1 call to HtmlDrupalDumper::style()
HtmlDrupalDumper::dumpString in src/VarDumper/Dumper/HtmlDrupalDumper.php

File

src/VarDumper/Dumper/HtmlDrupalDumper.php, line 393

Class

HtmlDrupalDumper
HtmlDrupalDumper dumps variables as HTML.

Namespace

Drupal\vardumper\VarDumper\Dumper

Code

protected function style($style, $value, $attr = []) {
  if ($value === '') {
    return '';
  }
  $v = htmlspecialchars($value, \ENT_QUOTES, 'UTF-8');
  if ($style === 'note' && FALSE !== ($c = mb_strrpos($v, '\\'))) {
    return $this
      ->getClassStyle($style, $v, $c);
  }
  if ($style === 'link') {
    $parts = explode('|', $value);
    return sprintf('<a href=%s>%s</a>', mb_substr($parts[0], 6), $parts[1]);
  }
  return parent::style($style, $value, $attr);
}