protected function WebformVariantFormBase::getVariantElementsAsOptions in Webform 8.5
Same name and namespace in other branches
- 6.x src/Form/WebformVariantFormBase.php \Drupal\webform\Form\WebformVariantFormBase::getVariantElementsAsOptions()
Get key/value array of webform variant elements.
Return value
array A key/value array of webform variant elements.
1 call to WebformVariantFormBase::getVariantElementsAsOptions()
- WebformVariantFormBase::buildForm in src/
Form/ WebformVariantFormBase.php - Form constructor.
File
- src/
Form/ WebformVariantFormBase.php, line 365
Class
- WebformVariantFormBase
- Provides a base webform for webform variants.
Namespace
Drupal\webform\FormCode
protected function getVariantElementsAsOptions() {
$webform = $this
->getWebform();
$variant_plugin_id = $this
->getWebformVariant()
->getPluginId();
$elements = $this
->getWebform()
->getElementsVariant();
$options = [];
foreach ($elements as $element_key) {
$element = $webform
->getElement($element_key);
if ($element['#variant'] === $variant_plugin_id) {
$options[$element_key] = WebformElementHelper::getAdminTitle($element);
}
}
return $options;
}