/**
  * {@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;
 }
Esempio n. 2
0
 /**
  * {@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);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getFormType($propertyName, FormType $formType = null)
 {
     if ($propertyName == 'fields') {
         if (!$formType) {
             return;
         }
         $options = array_map(function ($field) {
             return array('value' => $field, 'label' => $field);
         }, static::$fieldsList);
         $formType->setOptions($options);
     }
     return $formType;
 }
 /**
  * {@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;
 }
Esempio n. 5
0
 /**
  * {@inheritdoc}
  */
 public function getFormType($propertyName, FormType $formType = null)
 {
     if ($propertyName == 'scope') {
         //get the form type associated on the model we want
         $userFieldsFormType = \PopCode\Framework\Form\FormFactory::getFormType('FacebookAWD\\Plugin\\Connect\\Model\\SubscriptionFieldsPermission', 'fields');
         //set the options
         $formType->setOptions($userFieldsFormType->getOptions());
     }
     return $formType;
 }
Esempio n. 6
0
 /**
  * Create form
  *
  * @param array $config
  *
  * @return \PopCode\Framework\Form\AbstractForm
  */
 public static function createForm($id, \PopCode\Framework\Form\FormType $formType, $data = null)
 {
     $type = $formType->getType();
     $class = static::getMapping($type);
     return new $class($id, $formType, $data);
 }