OS : Linux
PHP Version : 7.4.33
Software : choiceChildren = $params['choiceChildren'];
}
$this->wrapStyle = isset($params['wrap']) ? $params['wrap'] : self::WRAP_PARAGRAPH;
switch ($this->wrapStyle) {
case self::WRAP_LINE_BREAK:
//A few WordPress settings pages use this.
$this->beforeOption = '';
$this->afterOption = ' ';
$this->afterOption = ' tags would mess up the grid.
$beforeOption = $afterOption = '';
}
//buildTag() is safe, and we intentionally allow HTML in the label and description.
//phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->buildTag(
'fieldset',
[
'class' => $classes,
'style' => $this->styles,
'disabled' => !$this->isEnabled(),
'data-bind' => $this->makeKoDataBind($this->getKoEnableBinding()),
]
);
foreach ($this->options as $option) {
$isChecked = ($currentValue === $option->value);
echo $beforeOption;
$labelClasses = ['ame-rg-option-label'];
if ( isset($this->choiceChildren[$option->value]) ) {
$labelClasses[] = 'ame-rg-has-choice-child';
}
echo $this->buildTag('label', ['class' => $labelClasses]);
echo $this->buildTag(
'input',
array_merge([
'type' => 'radio',
'name' => $fieldName,
'value' => $this->mainSetting->encodeForForm($option->value),
'class' => $this->inputClasses,
'checked' => $isChecked,
'disabled' => !$option->enabled,
'id' => $this->getRadioInputId($option),
'data-bind' => $this->makeKoDataBind([
'checked' => $this->getKoObservableExpression($option->value),
'checkedValue' => wp_json_encode($option->value),
]),
], $this->inputAttributes)
);
echo ' ', $option->label;
if ( !empty($option->description) ) {
if ( $this->descriptionsAsTooltips ) {
echo ' ';
$renderer->renderTooltipTrigger(new Tooltip(
$option->description,
Tooltip::INFO,
['ame-understated-tooltip']
));
} else {
echo self::formatNestedDescription($option->description);
}
}
echo '';
echo $afterOption;
if ( isset($this->choiceChildren[$option->value]) ) {
$childControl = $this->choiceChildren[$option->value];
echo HtmlHelper::tag('span', ['class' => 'ame-rg-nested-control']);
$renderer->renderControl($childControl);
echo '
';
break;
case self::WRAP_PARAGRAPH:
//"Settings -> Reading" uses this, and AME used it in the "Settings" tab.
$this->beforeOption = '