ConfigTranslationEntityListBuilder::sortRowsMultiple

protected ConfigTranslationEntityListBuilder::sortRowsMultiple($a, $b, $keys)

Sorts an array by multiple criteria.

Parameters

array $a: First item for comparison.

array $b: Second item for comparison.

array $keys: The array keys to sort on.

Return value

int The comparison result for uasort().

File

core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php, line 114

Class

ConfigTranslationEntityListBuilder
Defines the configuration translation list builder for entities.

Namespace

Drupal\config_translation\Controller

Code

protected function sortRowsMultiple($a, $b, $keys) {
  $key = array_shift($keys);
  $a_value = (is_array($a) && isset($a[$key]['data'])) ? $a[$key]['data'] : '';
  $b_value = (is_array($b) && isset($b[$key]['data'])) ? $b[$key]['data'] : '';

  if ($a_value == $b_value && !empty($keys)) {
    return $this->sortRowsMultiple($a, $b, $keys);
  }

  return strnatcasecmp($a_value, $b_value);
}
doc_Drupal
2016-10-29 08:54:52
Comments
Leave a Comment

Please login to continue.