/**
  * Basic form submit info.
  *
  * @param array $attr
  * @param array $postData
  *
  * @return array|bool
  */
 protected function handleFormSubmit($attr, $postData)
 {
     $postData = isset($postData[$this->getUniqueId()]) ? $postData[$this->getUniqueId()] : false;
     $status = array();
     // Only do some work, if we have a type and the postData points to us.
     if (isset($attr['type']) && $postData) {
         switch (strtolower($attr['type'])) {
             case 'subscribe':
                 $status = $this->handleSubscribeSubmit($attr, $postData);
                 break;
             case 'unsubscribe':
                 $status = $this->handleUnsubscribe($attr, $postData);
                 break;
             default:
         }
     }
     // Store status for templating
     TemplateWrapper::registerInstance('submit', $status);
     return $status;
 }
Example #2
0
 /**
  * Creates an unique field id based on the given name
  * @param $name
  * @return string
  */
 function wptripolis_form_field_id($name)
 {
     return \WPTripolis\TemplateWrapper::createFieldId($name);
 }