id = 'n2_form_' . self::$counter++;
$this->controlName = $controlName;
$this->setMVCHelper($MVCHelper);
$this->context = new Data();
parent::__construct();
$this->container = new ContainerMain($this);
}
/**
* @return ContainerMain
*/
public function getContainer() {
return $this->container;
}
public function getId() {
return $this->id;
}
/**
* @return Data
*/
public function getContext() {
return $this->context;
}
/**
* @param $path
*
* @return ContainerInterface|AbstractField
*/
public function getElement($path) {
/**
* Remove starting / path separator
*/
return $this->container->getElement(substr($path, 1));
}
public function render() {
echo '
';
$this->container->renderContainer();
echo '
';
}
/**
* @return string
*/
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();
}
/**
* @return FieldsetHidden
*/
public function getFieldsetHidden() {
return $this->container->getFieldsetHidden();
}
public function setDark() {
$this->classes[] = 'n2_form--dark';
}
public function addClass($className) {
$this->classes[] = $className;
}
}
Form::init();