You are here

public function WebformElementBase::hasMultipleValues in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElementBase.php \Drupal\webform\Plugin\WebformElementBase::hasMultipleValues()

Checks if the element value has multiple values.

Parameters

array $element: An element.

Return value

bool TRUE if the element value has multiple values.

Overrides WebformElementInterface::hasMultipleValues

23 calls to WebformElementBase::hasMultipleValues()
Date::setDefaultValue in src/Plugin/WebformElement/Date.php
Set an element's default value using saved data.
DateBase::setDefaultValue in src/Plugin/WebformElement/DateBase.php
Set an element's default value using saved data.
EntityAutocomplete::hasMultipleValues in src/Plugin/WebformElement/EntityAutocomplete.php
Checks if the element value has multiple values.
OptionsBase::getElementSelectorInputValue in src/Plugin/WebformElement/OptionsBase.php
Get an element's (sub)input selector value.
OptionsBase::getElementSelectorOptions in src/Plugin/WebformElement/OptionsBase.php

... See full list

6 methods override WebformElementBase::hasMultipleValues()
Checkboxes::hasMultipleValues in src/Plugin/WebformElement/Checkboxes.php
Checks if the element value has multiple values.
EntityAutocomplete::hasMultipleValues in src/Plugin/WebformElement/EntityAutocomplete.php
Checks if the element value has multiple values.
WebformCustomComposite::hasMultipleValues in src/Plugin/WebformElement/WebformCustomComposite.php
Checks if the element value has multiple values.
WebformTableSelectSort::hasMultipleValues in src/Plugin/WebformElement/WebformTableSelectSort.php
Checks if the element value has multiple values.
WebformTableSort::hasMultipleValues in src/Plugin/WebformElement/WebformTableSort.php
Checks if the element value has multiple values.

... See full list

File

src/Plugin/WebformElementBase.php, line 595

Class

WebformElementBase
Provides a base class for a webform element.

Namespace

Drupal\webform\Plugin

Code

public function hasMultipleValues(array $element) {
  if ($this
    ->hasProperty('multiple')) {
    if (isset($element['#multiple'])) {
      return $element['#multiple'];
    }
    else {
      $default_property = $this
        ->getDefaultProperties();
      return $default_property['multiple'];
    }
  }
  else {
    return FALSE;
  }
}