W3cubDocs

/Drupal 8

protected function DiffFormatter::_block

protected DiffFormatter::_block($xbeg, $xlen, $ybeg, $ylen, &$edits)

File

core/lib/Drupal/Component/Diff/DiffFormatter.php, line 111

Class

DiffFormatter
A class to format Diffs

Namespace

Drupal\Component\Diff

Code

protected function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) {
  $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen));
  foreach ($edits as $edit) {
    if ($edit->type == 'copy') {
      $this->_context($edit->orig);
    }
    elseif ($edit->type == 'add') {
      $this->_added($edit->closing);
    }
    elseif ($edit->type == 'delete') {
      $this->_deleted($edit->orig);
    }
    elseif ($edit->type == 'change') {
      $this->_changed($edit->orig, $edit->closing);
    }
    else {
      trigger_error('Unknown edit type', E_USER_ERROR);
    }
  }
  $this->_end_block();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Diff!DiffFormatter.php/function/DiffFormatter::_block/8.1.x