You are here

public function BotchaFormAbstract::setEnabled in BOTCHA Spam Prevention 6.2

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

File

controller/botcha_form.controller.inc, line 87
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 setEnabled($enabled) {
  $form_id = $this->id;

  // Cast to boolean first.
  $enabled = (bool) $enabled;

  // Cast to integer.
  $enabled = (int) $enabled;
  variable_set("botcha_enabled_{$form_id}", $enabled);
  return $this;
}