protected function renderOption(Form $form, array $parameters)
{
$name = $parameters['itemFormElName'];
$value = $parameters['itemFormElValue'];
$onChange = 'onclick="if (confirm(TBE_EDITOR.labels.onChangeAlert)
&& TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };"';
$selector = '';
try {
$extension = $form->getExtensionName();
$thumbnail = MiscellaneousUtility::getIconForTemplate($form);
$template = pathinfo($form->getOption(Form::OPTION_TEMPLATEFILE), PATHINFO_FILENAME);
$formLabel = $form->getLabel();
if (strpos($formLabel, 'LLL:') === 0) {
$label = LocalizationUtility::translate($formLabel, $extension);
} else {
$label = $formLabel;
}
$optionValue = $extension . '->' . lcfirst($template);
$selected = $optionValue == $value ? ' checked="checked"' : '';
$option = '<label style="padding: 0.5em; border: 1px solid #CCC; display: inline-block; ' . 'vertical-align: bottom; margin: 0 1em 1em 0; cursor: pointer; ' . ($selected ? 'background-color: #DDD;' : '') . '">';
$option .= '<img src="' . $thumbnail . '" alt="' . $label . '" style="margin: 0.5em 0 0.5em 0; ' . 'max-width: 196px; max-height: 128px;"/><br />';
$option .= '<input type="radio" value="' . $optionValue . '"' . $selected . ' name="' . $name . '" ' . $onChange . ' /> ' . $label;
$option .= '</label>';
$selector .= $option . LF;
} catch (\RuntimeException $error) {
$this->configurationService->debug($error);
}
return $selector;
}