I am working on a custom Display plugin for Views. In my buildOptionsForm() method, I have the following:

$form['inherit_yaxis'] = [
  '#title' => $this->t('The title'),
  '#type' => 'radios',
  '#options' => [
     1 => $this->t('Inherit primary of parent display'),
     0 => $this->t('Create a secondary axis'),
  '#default_value' => $this->getOption('inherit_yaxis'),
  '#description' => $this->t('The description'),

In the optionsSummary(), if I do this:

$options['inherit_yaxis']['value'] = $this->getOption('inherit_yaxis');

It shows 1 or 0 rather than the label that I want ('Inherit primary of parent display' or 'Create a secondary axis').

What should be on the other side of $options['inherit_yaxis']['value'] = so that the label shows but the value stays either 0 or 1?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.