You are here

public function Citation::buildOptionsForm in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/Plugin/views/field/Citation.php \Drupal\bibcite_entity\Plugin\views\field\Citation::buildOptionsForm()

Default options form that provides the label widget that all fields should have.

Overrides FieldPluginBase::buildOptionsForm

File

modules/bibcite_entity/src/Plugin/views/field/Citation.php, line 72

Class

Citation
Field handler to render bibcite reference as citation.

Namespace

Drupal\bibcite_entity\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['csl_style'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('CSL style'),
    '#empty_option' => $this
      ->t('- Default -'),
    '#options' => array_map(function (CslStyleInterface $style) {
      return $style
        ->label();
    }, $this->styler
      ->getAvailableStyles()),
    '#default_value' => $this->options['csl_style'],
  ];
}