You are here

public function DiffFormatter::__construct in Diff 8

Creates a DiffFormatter to render diffs in a table.

We need to extend the constructor of the diff formatter used by the core config system in order to provide our own settings.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

Overrides DiffFormatter::__construct

File

src/DiffFormatter.php, line 22

Class

DiffFormatter
Diff formatter which returns output that can be rendered to a table.

Namespace

Drupal\diff

Code

public function __construct(ConfigFactoryInterface $config_factory) {
  parent::__construct($config_factory);
  $config = $config_factory
    ->get('diff.settings');
  $this->leading_context_lines = $config
    ->get('general_settings.context_lines_leading');
  $this->trailing_context_lines = $config
    ->get('general_settings.context_lines_trailing');
}