public static function BotchaFormAbstract::getForm in BOTCHA Spam Prevention 7.2
Same name and namespace in other branches
- 6.2 controller/botcha_form.controller.inc \BotchaFormAbstract::getForm()
@todo BotchaForm getForm Description.
Parameters
string $form_id:
boolean $create: Determines should we construct new form or return NULL if it does not exist.
Return value
File
- controller/
botcha_form.controller.inc, line 36 - Controller layer of the BotchaForm objects.
Class
- BotchaFormAbstract
- Special class to abstract operations with form_id. Casual usage is getting all recipe books by form_id. It could be done by adding one more method to Botcha (such as "getRecipebookByFormId") but in long-time perspective it is…
Code
public static function getForm($form_id, $create = TRUE) {
$none = TRUE;
// Respect form exceptions (done by forbidden_forms recipe book).
//if (!in_array($form_id, array('user_login', 'user_login_block', 'update_script_selection_form'))) {
$form = BotchaFormModel::getForm($form_id);
if ($form || $create) {
$none = FALSE;
}
//}
$botcha_form = $none ? new BotchaFormNone($form_id) : new BotchaForm($form_id);
return $botcha_form;
}