MaGeFH
Active member
- Affected version
- DP10
The macro specifies the argument as optional with a default value of false:
However, if the macro invocation omits the
This does not work (at least in Chrome 59.0.3071.115 (64-Bit) and Firefox 54.0.1 (64-Bit) on Mac OS 10.12.6) however. This is correct according to the spec.
In order to get an optional color picker into the form, you would need to do this:
I would suggest changing the macro, but that would only fix it for this element. I dug a bit deeper and found that you don't seem to handle boolean attributes properly in
Something like this would fix it. Quick'n'dirty test code, you have been warned...
arg-required="false"
However, if the macro invocation omits the
arg-required
parameter the generated HTML code looks like this:
HTML:
<input type="text" class="input" name="fh_ad_type_options[color_url]" required="false">
This does not work (at least in Chrome 59.0.3071.115 (64-Bit) and Firefox 54.0.1 (64-Bit) on Mac OS 10.12.6) however. This is correct according to the spec.
In order to get an optional color picker into the form, you would need to do this:
HTML:
<xf:macro template="public:color_picker_macros" name="color_picker_row"
arg-name="fh_ad_type_options[color_url]"
arg-label="{{ phrase('fh_ad_advert_type_afscustom_color_url') }}"
arg-value="{$ad.type.options.color_url}"
arg-required=""
arg-allowPalette="true" />
I would suggest changing the macro, but that would only fix it for this element. I dug a bit deeper and found that you don't seem to handle boolean attributes properly in
XF\Template\Templater::processUnhandledAttributes
.Something like this would fix it. Quick'n'dirty test code, you have been warned...
PHP:
if (in_array($name, ['required', 'checked', 'disabled', 'selected']))
{
if ((false === (bool)$value) OR ('false' === strval(strtolower(trim($value)))))
{
continue;
}
}