You are here

protected function DiffFormatter::improvePadding in Entity Share 8.3

Helper function: replaces initial plain spaces with HTML spaces in markup.

Parameters

array $output: An array representing a table row.

Return value

array An array representing a table row.

3 calls to DiffFormatter::improvePadding()
DiffFormatter::addedLine in modules/entity_share_diff/src/Diff/DiffFormatter.php
Creates an added line.
DiffFormatter::contextLine in modules/entity_share_diff/src/Diff/DiffFormatter.php
Creates a context line.
DiffFormatter::deletedLine in modules/entity_share_diff/src/Diff/DiffFormatter.php
Creates a deleted line.

File

modules/entity_share_diff/src/Diff/DiffFormatter.php, line 71

Class

DiffFormatter
Diff formatter which renders a table, with structured padding in HTML.

Namespace

Drupal\entity_share_diff\Diff

Code

protected function improvePadding(array $output) {
  if (!$this->htmlOutput) {
    return $output;
  }
  $markup = $output[1]['data']['#markup'];
  $trimmed_markup = ltrim($markup);
  $diff_length = strlen($markup) - strlen($trimmed_markup);
  if ($diff_length > 0) {
    $output[1]['data']['#markup'] = str_repeat(' ', $diff_length) . $trimmed_markup;
  }
  return $output;
}