You are here

protected function MappingForm::sortOptions in Feeds 8.3

Builds an options list from mapping sources or targets.

Parameters

array $options: The options to sort.

Return value

array The sorted options.

1 call to MappingForm::sortOptions()
MappingForm::buildForm in src/Form/MappingForm.php
Form constructor.

File

src/Form/MappingForm.php, line 651

Class

MappingForm
Provides a form for mapping settings.

Namespace

Drupal\feeds\Form

Code

protected function sortOptions(array $options) {
  $result = [];
  foreach ($options as $k => $v) {
    if (is_array($v) && !empty($v['label'])) {
      $result[$k] = $v['label'];
    }
    elseif (is_array($v)) {
      $result[$k] = $k;
    }
    else {
      $result[$k] = $v;
    }
  }
  asort($result);
  return $result;
}