You are here

protected function OptionsBase::defineDefaultProperties in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/OptionsBase.php \Drupal\webform\Plugin\WebformElement\OptionsBase::defineDefaultProperties()

Define an element's default properties.

Return value

array An associative array contain an the element's default properties.

Overrides WebformElementBase::defineDefaultProperties

7 calls to OptionsBase::defineDefaultProperties()
Checkboxes::defineDefaultProperties in src/Plugin/WebformElement/Checkboxes.php
Define an element's default properties.
Radios::defineDefaultProperties in src/Plugin/WebformElement/Radios.php
Define an element's default properties.
Select::defineDefaultProperties in src/Plugin/WebformElement/Select.php
Define an element's default properties.
TableSelect::defineDefaultProperties in src/Plugin/WebformElement/TableSelect.php
Define an element's default properties.
WebformTableSelectSort::defineDefaultProperties in src/Plugin/WebformElement/WebformTableSelectSort.php
Define an element's default properties.

... See full list

7 methods override OptionsBase::defineDefaultProperties()
Checkboxes::defineDefaultProperties in src/Plugin/WebformElement/Checkboxes.php
Define an element's default properties.
Radios::defineDefaultProperties in src/Plugin/WebformElement/Radios.php
Define an element's default properties.
Select::defineDefaultProperties in src/Plugin/WebformElement/Select.php
Define an element's default properties.
TableSelect::defineDefaultProperties in src/Plugin/WebformElement/TableSelect.php
Define an element's default properties.
WebformTableSelectSort::defineDefaultProperties in src/Plugin/WebformElement/WebformTableSelectSort.php
Define an element's default properties.

... See full list

File

src/Plugin/WebformElement/OptionsBase.php, line 42

Class

OptionsBase
Provides a base 'options' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

protected function defineDefaultProperties() {
  $properties = [
    // Options settings.
    'options' => [],
    'options_randomize' => FALSE,
  ] + parent::defineDefaultProperties();

  // Add other properties to elements that include the other text field.
  if ($this
    ->isOptionsOther()) {
    $properties += [
      'other__option_label' => $this
        ->t('Other…'),
      'other__type' => 'textfield',
      'other__title' => '',
      'other__placeholder' => $this
        ->t('Enter other…'),
      'other__description' => '',
      // Text field or textarea.
      'other__size' => '',
      'other__maxlength' => '',
      'other__field_prefix' => '',
      'other__field_suffix' => '',
      // Textarea.
      'other__rows' => '',
      // Number.
      'other__min' => '',
      'other__max' => '',
      'other__step' => '',
      // Counter.
      'other__counter_type' => '',
      'other__counter_minimum' => '',
      'other__counter_minimum_message' => '',
      'other__counter_maximum' => '',
      'other__counter_maximum_message' => '',
      // Wrapper.
      'wrapper_type' => 'fieldset',
    ];
  }
  return $properties;
}