You are here

protected function WebformEntityOptionsTrait::defineDefaultProperties in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformEntityOptionsTrait.php \Drupal\webform\Plugin\WebformElement\WebformEntityOptionsTrait::defineDefaultProperties()
2 methods override WebformEntityOptionsTrait::defineDefaultProperties()
WebformTermCheckboxes::defineDefaultProperties in src/Plugin/WebformElement/WebformTermCheckboxes.php
Define an element's default properties.
WebformTermSelect::defineDefaultProperties in src/Plugin/WebformElement/WebformTermSelect.php
Define an element's default properties.

File

src/Plugin/WebformElement/WebformEntityOptionsTrait.php, line 15

Class

WebformEntityOptionsTrait
Provides an 'entity_reference' with options trait.

Namespace

Drupal\webform\Plugin\WebformElement

Code

protected function defineDefaultProperties() {
  $properties = parent::defineDefaultProperties() + [
    // Entity reference settings.
    'target_type' => '',
    'selection_handler' => '',
    'selection_settings' => [],
  ];
  unset($properties['options'], $properties['options_description_display']);
  switch ($this
    ->getPluginId()) {
    case 'webform_entity_checkboxes':

      // Remove 'None of the above' options.
      unset($properties['options_none'], $properties['options_none_value'], $properties['options_none_text']);
      break;
    case 'webform_entity_radios':

      // Remove format multiple items.
      unset($properties['format_items'], $properties['format_items_html'], $properties['format_items_text']);
      break;
  }
  return $properties;
}