You are here

protected function ConfigHandler::getRemovableEdits in Update helper 8

Same name and namespace in other branches
  1. 2.x src/ConfigHandler.php \Drupal\update_helper\ConfigHandler::getRemovableEdits()

Get edits that should be removed before applying change action.

Parameters

array $original_edits: Original list of edits for compare.

array $new_edits: New list of edits for compare.

Return value

array Returns list of edits that should be removed.

1 call to ConfigHandler::getRemovableEdits()
ConfigHandler::getUpdateConfig in src/ConfigHandler.php
Get list of configuration changes with change action (add, delete, change).

File

src/ConfigHandler.php, line 305

Class

ConfigHandler
Configuration handler.

Namespace

Drupal\update_helper

Code

protected function getRemovableEdits(array $original_edits, array $new_edits) {
  $additional_edits = array_udiff($original_edits, $new_edits, function ($diff_row1, $diff_row2) {
    $key1 = explode(' : ', $diff_row1);
    $key2 = explode(' : ', $diff_row2);

    // Values from flat array will be marked for removal.
    if (substr($key1[0], -3) === '::-' && substr($key2[0], -3) === '::-') {
      return -1;
    }
    return strcmp($key1[0], $key2[0]);
  });
  return $additional_edits;
}