You are here

function _better_revisions_options in Better Revisions 8

Same name and namespace in other branches
  1. 7 better_revisions.module \_better_revisions_options()

Custom list options.

1 call to _better_revisions_options()
better_revisions_form_alter in ./better_revisions.module
Implements hook_form_alter().

File

./better_revisions.module, line 120
Main enhanced revisions module file.

Code

function _better_revisions_options() {
  $config = \Drupal::config('better_revisions.settings');
  $opts = $config
    ->get('br_list_options');
  $options = explode("\n", $opts);
  $options_array = [
    '' => t('Please select'),
  ];
  foreach ($options as $option) {
    $option = trim($option);
    $matches = [];
    if (preg_match('/(.*)\\|(.*)/', $option, $matches)) {
      $options_array[$matches[1]] = $matches[2];
    }
    else {
      $options_array[$option] = $option;
    }
  }
  return $options_array;
}