You are here

public function BotchaFormAbstract::getRecipebook in BOTCHA Spam Prevention 6.2

Same name and namespace in other branches
  1. 7.2 controller/botcha_form.controller.inc \BotchaFormAbstract::getRecipebook()

@todo BotchaForm getRecipebook Description.

Return value

BotchaRecipebook

1 call to BotchaFormAbstract::getRecipebook()
BotchaForm::createAdminLinksFieldset in controller/botcha_form.controller.inc
1 method overrides BotchaFormAbstract::getRecipebook()
BotchaFormNone::getRecipebook in controller/botcha_form.controller.inc
@todo BotchaForm getRecipebook Description.

File

controller/botcha_form.controller.inc, line 69
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 function getRecipebook() {
  if (!isset($this->recipebook)) {
    $rbs = array_keys(BotchaModel::getRecipebooksForms(array(
      'mode' => 'recipebook',
      'forms' => $this->id,
    )));

    // In fact there is not more than 1 item.
    $this->recipebook = !empty($rbs) ? current($rbs) : 'none';
  }
  return Botcha::getRecipebook($this->recipebook, FALSE);
}