You are here

public function YamlFormCheckboxesOther::getElementSelectorOptions in YAML Form 8

Get an element's selectors as options.

Parameters

array $element: An element.

Return value

array An array of element selectors.

Overrides YamlFormElementBase::getElementSelectorOptions

File

src/Plugin/YamlFormElement/YamlFormCheckboxesOther.php, line 37

Class

YamlFormCheckboxesOther
Provides a 'checkboxes_other' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function getElementSelectorOptions(array $element) {
  $title = $this
    ->getAdminLabel($element);
  $name = $element['#yamlform_key'];
  $selectors = [];
  foreach ($element['#options'] as $input_name => $input_title) {
    $selectors[":input[name=\"{$name}[checkboxes][{$input_name}]\"]"] = $input_title . ' [' . $this
      ->t('Checkboxes') . ']';
  }
  $selectors[":input[name=\"{$name}[other]\"]"] = $title . ' [' . $this
    ->t('Textfield') . ']';
  return [
    $title => $selectors,
  ];
}