/** * {@ineritedDoc} */ public function build() { if (!is_object($this->data)) { return $this; } $className = get_class($this->data); $propertyAccessor = $this->getPropertyAccessor(); foreach ($propertyAccessor->getProperties() as $prop) { //no static property if ($prop->isStatic()) { continue; } //only if form type exists $formType = FormFactory::getFormType($className, $prop); if (!$formType) { continue; } //text domain if (!$formType->getPtd()) { $formType->setPtd($this->getFormType()->getPtd()); } $name = $prop->getName(); $value = $propertyAccessor->getPropertyValue($name, $this->data); $subForm = FormFactory::createForm($name, $formType, $value); $this->add($name, $subForm); $subForm->build(); } return $this; }
/** * {@inheritdoc} */ public function init() { $formType = new FormType(); $formType->setPtd($this->container->getPtd()); $formType->setEntity('FacebookAWD\\Plugin\\Connect\\Model\\LoginButton'); $this->generator = FormFactory::createForm($this->container->getSlug() . '_generator', $formType); $this->generator->build(); return $this; }
/** * {@ineritedDoc} */ public function build() { parent::build(); //add the security form to the root form if (!$this->hasParent()) { $csrfType = new FormType(); $csrfType->setType('hidden'); $csrfType->setMapped(false); $csrfForm = FormFactory::createForm(static::$CSRF_KEY, $csrfType); $csrfForm->setData($this->getNonce()); $this->add(static::$CSRF_KEY, $csrfForm); } }
/** * Parse the shortcode. */ public function shortcode($options, $content = null) { $object = new $this->class(); $this->form = FormFactory::createForm('shortcode', new FormType(), $object); $configs = Helper::keysToCamelCase($options); if ($content) { $configs['content'] = $content; } $form = FormFactory::createForm('shortcode', new FormType(), $object); $form->build(); $form->bind(array('shortcode' => $configs)); return call_user_func_array($this->callback, array($object)); }
/** * {@inheritdoc} */ public function init() { //Init screen settings form $screen = $this->om->get($this->container->getSlug() . '.login'); if (!$screen instanceof WPLoginScreen) { $screen = new WPLoginScreen(); } else { $screen = clone $screen; } $formType = new FormType(); $formType->setPtd($this->container->getPtd()); $formType->setEntity('FacebookAWD\\Plugin\\Connect\\Model\\WPLoginScreen'); $this->settingsForm = FormFactory::createForm($this->container->getSlug() . '_login', $formType, $screen); $this->settingsForm->build(); return $this; }