Frontend\Modules\FormBuilder\Event\FormBuilderSubmittedEvent::getForm PHP Method

getForm() public method

public getForm ( ) : array
return array
    public function getForm()
    {
        return $this->form;
    }

Usage Example

コード例 #1
0
 /**
  * On FormBuilderSubmittedEvent
  *
  * @param FormBuilderSubmittedEvent $event
  */
 public function onFormBuilderSubmittedEvent(FormBuilderSubmittedEvent $event)
 {
     if ($this->modulesSettings->get('Mailmotor', 'automatically_subscribe_from_form_builder_submitted_form', false)) {
         $form = $event->getForm();
         $data = $event->getData();
         $email = null;
         // Check if we have a replyTo email set
         foreach ($form['fields'] as $field) {
             if (array_key_exists('reply_to', $field['settings']) && $field['settings']['reply_to'] === true) {
                 $email = unserialize($data[$field['id']]['value']);
             }
         }
         // Define language
         $language = array_key_exists('language', $form) ? $form['language'] : $this->modulesSettings->get('Core', 'default_language', 'en');
         // We subscribe the replyTo email
         try {
             // Does email exists or not in our mailing list
             $exists = (bool) $this->subscriber->exists($email);
             // We only need to subscribe when not exists
             if (!$exists) {
                 $this->subscriber->subscribe($email, $language, array(), array(), false);
             }
         } catch (NotImplementedException $e) {
             // We do nothing as fallback when no mail-engine is chosen in the Backend
         }
     }
 }
All Usage Examples Of Frontend\Modules\FormBuilder\Event\FormBuilderSubmittedEvent::getForm