public static function BotchaModel::getRecipebooksForms in BOTCHA Spam Prevention 6.3
Same name and namespace in other branches
- 6.2 model/botcha.model.inc \BotchaModel::getRecipebooksForms()
- 7.2 model/botcha.model.inc \BotchaModel::getRecipebooksForms()
- 7.3 model/application/botcha.application.model.inc \BotchaModel::getRecipebooksForms()
Overrides IBotchaModel::getRecipebooksForms
3 calls to BotchaModel::getRecipebooksForms()
- BotchaForm::getRecipebook in controller/
form/ botcha.form.controller.inc - @todo BotchaForm getRecipebook Description.
- BotchaModel::getFormsRecipebooks in model/
application/ botcha.application.model.inc - Just an alias for getRecipebooksForms.
- BotchaRecipebook::getForms in controller/
recipebook/ botcha.recipebook.controller.inc - @todo BotchaRecipebook getForms Description.
File
- model/
application/ botcha.application.model.inc, line 136 - Contains BotchaModel class.
Class
Code
public static function getRecipebooksForms($parameters = array()) {
$fields = array();
switch ($parameters['mode']) {
case 'form':
$fields[] = 'form_id';
break;
case 'recipebook':
default:
$fields[] = 'rbid';
break;
}
$rbf = db_select('botcha_recipebook_form', 'brf')
->fields('brf', $fields);
if (!empty($parameters['recipebooks'])) {
$rbf
->condition('rbid', (array) $parameters['recipebooks'], 'IN');
}
if (!empty($parameters['forms'])) {
$rbf
->condition('form_id', (array) $parameters['forms'], 'IN');
}
// Catching of PDOException helps to avoid WSOD during update use case. The
// reason is in that form_alter is called before performing an update.
// @see http://drupal.org/node/1828710
try {
$result = $rbf
->execute()
->fetchCol();
} catch (Exception $e) {
if ($e instanceof PDOException) {
watchdog_exception('BOTCHA', $e, 'Please perform an update via update.php or reinstall the BOTCHA module to fix the reason of this warning! %type: !message in %function (line %line of %file).', array(), WATCHDOG_WARNING);
$result = array();
}
}
return $result;
}