public function OptionsLimitWebformHandler::getSummary in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php \Drupal\webform_options_limit\Plugin\WebformHandler\OptionsLimitWebformHandler::getSummary()
Returns a render array summarizing the configuration of the webform handler.
Return value
array A render array.
Overrides WebformHandlerBase::getSummary
File
- modules/
webform_options_limit/ src/ Plugin/ WebformHandler/ OptionsLimitWebformHandler.php, line 145
Class
- OptionsLimitWebformHandler
- Webform options and boolean (boolean) limit handler.
Namespace
Drupal\webform_options_limit\Plugin\WebformHandlerCode
public function getSummary() {
$settings = $this
->getSettings();
$element = $this
->getWebform()
->getElement($settings['element_key']);
if ($element) {
$webform_element = $this->elementManager
->getElementInstance($element);
$t_args = [
'@title' => $webform_element
->getAdminLabel($element),
'@type' => $webform_element
->getPluginLabel(),
];
$settings['element_key'] = $this
->t('@title (@type)', $t_args);
}
elseif (empty($settings['element_key'])) {
$settings['element_key'] = [
'#type' => 'link',
'#title' => $this
->t('Please add a new options or checkbox element.'),
'#url' => $this
->getWebform()
->toUrl('edit-form'),
];
}
else {
$settings['element_key'] = [
'#markup' => $this
->t("'@element_key' is missing.", [
'@element_key' => $settings['element_key'],
]),
'#prefix' => '<b class="color-error">',
'#suffix' => '</b>',
];
}
// Unset limit if element type is not a boolean.
if (!$this
->isBooleanElement()) {
unset($settings['limit']);
}
return [
'#settings' => $settings,
] + parent::getSummary();
}