You are here

public static function BotchaRecipebookAbstract::getRecipebook in BOTCHA Spam Prevention 6.2

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

File

controller/botcha_recipebook.controller.inc, line 37
Controller layer of the BotchaRecipebook objects.

Class

BotchaRecipebookAbstract
@file Controller layer of the BotchaRecipebook objects.

Code

public static function getRecipebook($id, $create = TRUE) {
  $none = TRUE;
  if ($id != 'none') {
    $rb = BotchaRecipebookModel::getRecipebook($id);
    if ($rb || $create) {
      $none = FALSE;
    }
  }
  if ($none) {
    $recipebook = new BotchaRecipebookNone($id);
  }
  else {
    $recipebook = new BotchaRecipebook($id);
    if ($rb) {
      $recipebook
        ->setTitle($rb->title)
        ->setDescription($rb->description);
    }
  }
  return $recipebook;
}