: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Nextend\Framework\Form\Element;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\View\Html;
class CheckboxOnOff extends AbstractFieldHidden {
protected $invert = false;
public function __construct($insertAt, $name, $label, $icon, $default = 0, $parameters = array()) {
parent::__construct($insertAt, $name, $label, $default, $parameters);
protected function fetchElement() {
'invert' => $this->invert,
'relatedFields' => $this->relatedFields
Js::addInline('new _N2.FormElementCheckboxOnOff("' . $this->fieldID . '", ' . json_encode($options) . ');');
'class' => 'n2_field_checkbox_onoff' . ($this->isActive() ? ' n2_field_checkbox_onoff--active' : '')
if (!empty($this->checkboxTip)) {
$attr['data-n2tip'] = $this->checkboxTip;
return Html::tag('div', $attr, '<i class="' . $this->icon . '"></i>' . parent::fetchElement());
protected function isActive() {
$value = $this->getValue();
if (!$this->invert && $value) {
} else if ($this->invert && !$value) {
public function setInvert($invert) {
public function setCheckboxTip($tip) {
$this->checkboxTip = $tip;