-
-
Save Liongold/d958fcc8f53bd3dd6e1c to your computer and use it in GitHub Desktop.
A code snippet showing the implementation of the 'Edit Listing' form in the Contributor Maps module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function RegistrationForm() { | |
// ... | |
$session = Session::get("FormInfo.RegistrationForm_Edit.data"); | |
if($key && $token) { | |
echo "test"; | |
$memory = ContributorMaps_Data::get()->filter(array( | |
'Unique_Key' => $key, | |
'EditToken' => $token, | |
'EditTokenExpires:GreaterThanOrEqual' => date('Y-m-d') | |
))->First(); | |
if(!$memory) { | |
return $this->redirect($this->Link("?action=edit&status=2")); | |
} | |
}else if(Session::get("FormInfo.RegistrationForm_Edit.data")) { | |
echo "Lorem ipsum blablabla"; | |
} | |
// ... | |
} | |
public function processEditForm($data, $form) { | |
// ... | |
if($errors > 0) { | |
//Session::set("FormInfo.{$form->FormName()}_Edit.data", $data); | |
Session::set("FormInfo.RegistrationForm_Edit.data"); | |
return $this->redirect($this->Link("?registered=3")); | |
}else{ | |
$entry->write(); | |
return $this->redirect($this->Link("?action=edit&status=4")); | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment