AndyB
Well-known member
Hello,
In the Options page of one of my add-ons I can get a Forum Chooser to work properly but only for multiple forum selection. Here's the PHP code:
When I change the following code:
$controlOptions['multiple'] = true;
from "true" to "false" I'm able to select just one forum from the drop down menu in the Options page, but I get the following error when I try to save the Options:
In the Options page of one of my add-ons I can get a Forum Chooser to work properly but only for multiple forum selection. Here's the PHP code:
PHP:
<?php
namespace Andy\BirthdayThread\Option;
class ForumChooser extends \XF\Option\AbstractOption
{
public static function renderSelect(\XF\Entity\Option $option, array $htmlParams)
{
/** @var \XF\Repository\Node $nodeRepo */
$nodeRepo = \XF::repository('XF:Node');
$choices = $nodeRepo->getNodeOptionsData(true, 'Forum', 'option');
$choices = array_map(function($v) {
$v['label'] = \XF::escapeString($v['label']);
return $v;
}, $choices);
$controlOptions = self::getControlOptions($option, $htmlParams);
$controlOptions['multiple'] = true;
$rowOptions = self::getRowOptions($option, $htmlParams);
return self::getTemplater()->formSelectRow($controlOptions, $choices, $rowOptions);
}
}
When I change the following code:
$controlOptions['multiple'] = true;
from "true" to "false" I'm able to select just one forum from the drop down menu in the Options page, but I get the following error when I try to save the Options: