: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\Form\Container\ContainerSubform;
use Nextend\Framework\Form\ContainerInterface;
use Nextend\Framework\Form\Element\AbstractFieldHidden;
use Nextend\Framework\Form\TraitFieldset;
use Nextend\Framework\View\Html;
abstract class SubFormIcon extends AbstractFieldHidden {
protected $containerSubform;
protected $plugins = array();
protected $options = array();
* SubFormIcon constructor.
* @param TraitFieldset $insertAt
* @param ContainerInterface $container
* @param array $parameters
public function __construct($insertAt, $name, $container, $ajaxUrl, $default = '', $parameters = array()) {
$this->ajaxUrl = $ajaxUrl;
parent::__construct($insertAt, $name, '', $default, $parameters);
$this->containerSubform = new ContainerSubform($container, $name . '-subform');
$this->getCurrentPlugin($this->getValue())
->renderFields($this->containerSubform);
protected function fetchElement() {
$currentValue = $this->getValue();
new _N2.FormElementSubformIcon(
"' . $this->fieldID . '",
"' . $this->ajaxUrl . '",
"' . $this->containerSubform->getId() . '",
$html = Html::openTag('div', array(
'class' => 'n2_field_subform_icon'
foreach ($this->options as $value => $option) {
$html .= Html::tag('div', array(
'class' => 'n2_field_subform_icon__option' . ($value == $currentValue ? ' n2_field_subform_icon__option--selected' : ''),
), Html::tag('div', array(
'class' => 'n2_field_subform_icon__option_icon'
), '<i class="' . $option['icon'] . '"></i>') . Html::tag('div', array(
'class' => 'n2_field_subform_icon__option_label'
$html .= parent::fetchElement() . '</div>';
protected abstract function loadOptions();
protected function getCurrentPlugin($value) {
if (!isset($this->plugins[$value])) {
list($value) = array_keys($this->plugins);
return $this->plugins[$value];
public function removeOption($option) {
if (isset($this->options[$option])) {
unset($this->options[$option]);
if ($this->getValue() === $option) {
$this->setValue($this->defaultValue);