You are here

public function Country::buildOptionsForm in Address 8

Same name in this branch
  1. 8 src/Plugin/views/sort/Country.php \Drupal\address\Plugin\views\sort\Country::buildOptionsForm()
  2. 8 src/Plugin/views/field/Country.php \Drupal\address\Plugin\views\field\Country::buildOptionsForm()

Basic options for all sort criteria

Overrides SortPluginBase::buildOptionsForm

File

src/Plugin/views/sort/Country.php, line 119

Class

Country
Sort handler for sorting by either country code or name.

Namespace

Drupal\address\Plugin\views\sort

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['sort_by'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Sort by'),
    '#options' => [
      self::COUNTRY_NAME => $this
        ->t('Country name'),
      self::COUNTRY_CODE => $this
        ->t('Country code'),
    ],
    '#default_value' => $this->options['sort_by'],
    '#weight' => -0.5,
  ];
}