You are here

public function WebformManagedFileBase::getElementSelectorOptions in Webform 6.x

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

Get an element's selectors as options.

Parameters

array $element: An element.

Return value

array An array of element selectors.

Overrides WebformElementBase::getElementSelectorOptions

See also

\Drupal\webform\Entity\Webform::getElementsSelectorSourceOption

File

src/Plugin/WebformElement/WebformManagedFileBase.php, line 482

Class

WebformManagedFileBase
Provides a base class webform 'managed_file' elements.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function getElementSelectorOptions(array $element) {
  $title = $this
    ->getAdminLabel($element);
  $name = $element['#webform_key'];
  $input = $this
    ->hasMultipleValues($element) ? ":input[name=\"files[{$name}][]\"]" : ":input[name=\"files[{$name}]\"]";
  return [
    $input => $title . '  [' . $this
      ->getPluginLabel() . ']',
  ];
}