: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Nextend\Framework\Form;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Form\Fieldset\FieldsetHidden;
use Nextend\Framework\Pattern\MVCHelperTrait;
class Form extends Data {
protected static $counter = 1;
/** @var Base\PlatformFormBase */
private static $platformForm;
protected $controlName = '';
protected $classes = array(
* @param MVCHelperTrait $MVCHelper
* @param string $controlName
public function __construct($MVCHelper, $controlName) {
$this->id = 'n2_form_' . self::$counter++;
$this->controlName = $controlName;
$this->setMVCHelper($MVCHelper);
$this->context = new Data();
$this->container = new ContainerMain($this);
public function getContainer() {
public function getId() {
public function getContext() {
* @return ContainerInterface|AbstractField
public function getElement($path) {
* Remove starting / path separator
return $this->container->getElement(substr($path, 1));
public function render() {
echo '<div class="' . esc_attr(implode(' ', $this->classes)) . '">';
$this->container->renderContainer();
public function getControlName() {
return $this->controlName;
public static function init() {
self::$platformForm = new WordPress\PlatformForm();
public static function tokenize() {
return self::$platformForm->tokenize();
public static function tokenizeUrl() {
return self::$platformForm->tokenizeUrl();
public static function checkToken() {
return self::$platformForm->checkToken();
public function getFieldsetHidden() {
return $this->container->getFieldsetHidden();
public function setDark() {
$this->classes[] = 'n2_form--dark';
public function addClass($className) {
$this->classes[] = $className;