/** * 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; }
/** * 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); }