You are here

public function Weight::buildOptionsForm in Ubercart 8.4

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

Overrides NumericField::buildOptionsForm

1 call to Weight::buildOptionsForm()
OrderWeightTotal::buildOptionsForm in uc_order/src/Plugin/views/field/OrderWeightTotal.php
Default options form that provides the label widget that all fields should have.
1 method overrides Weight::buildOptionsForm()
OrderWeightTotal::buildOptionsForm in uc_order/src/Plugin/views/field/OrderWeightTotal.php
Default options form that provides the label widget that all fields should have.

File

uc_store/src/Plugin/views/field/Weight.php, line 32

Class

Weight
Field handler to provide formatted weights.

Namespace

Drupal\uc_store\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['format'] = [
    '#title' => $this
      ->t('Format'),
    '#type' => 'radios',
    '#options' => [
      'uc_weight' => $this
        ->t('Ubercart weight'),
      'numeric' => $this
        ->t('Numeric'),
    ],
    '#default_value' => $this->options['format'],
    '#weight' => -1,
  ];
  foreach ([
    'separator',
    'format_plural',
    'prefix',
    'suffix',
  ] as $field) {
    $form[$field]['#states']['visible']['input[name="options[format]"]']['value'] = 'numeric';
  }
}