public function WebformSubmissionField::buildOptionsForm in Webform Views Integration 8.5
Default options form that provides the label widget that all fields should have.
Overrides FieldPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ field/ WebformSubmissionField.php, line 68
Class
- WebformSubmissionField
- Webform submission field.
Namespace
Drupal\webform_views\Plugin\views\fieldCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['webform_multiple_value'] = [
'#type' => 'radios',
'#title' => $this
->t('In this field show'),
'#options' => [
1 => $this
->t('All multiple values'),
0 => $this
->t('A value that corresponds to specific delta'),
],
'#default_value' => $this->options['webform_multiple_value'],
'#required' => TRUE,
'#access' => $this->definition['multiple'],
];
$form['webform_multiple_delta'] = [
'#type' => 'number',
'#title' => $this
->t('Delta'),
'#description' => $this
->t('Specify which delta to use for this field.'),
'#required' => TRUE,
'#default_value' => $this->options['webform_multiple_delta'],
'#access' => $this->definition['multiple'],
'#states' => [
'visible' => [
':input[name$="[webform_multiple_value]"]' => [
'value' => 0,
],
],
],
];
$form['webform_element_format'] = [
'#type' => 'select',
'#title' => $this
->t('Format'),
'#description' => $this
->t('Specify how to format this value.'),
'#options' => $this
->getWebformElementPlugin()
->getItemFormats(),
'#default_value' => $this->options['webform_element_format'] ?: $this
->getWebformElementPlugin()
->getItemDefaultFormat(),
];
$form['webform_element_format']['#access'] = !empty($form['webform_element_format']['#options']);
}