You are here

public function BotchaFormAbstract::addAdminLinks in BOTCHA Spam Prevention 6.2

Same name and namespace in other branches
  1. 7.2 controller/botcha_form.controller.inc \BotchaFormAbstract::addAdminLinks()
1 call to BotchaFormAbstract::addAdminLinks()
BotchaFormNone::addAdminLinks in controller/botcha_form.controller.inc
1 method overrides BotchaFormAbstract::addAdminLinks()
BotchaFormNone::addAdminLinks in controller/botcha_form.controller.inc

File

controller/botcha_form.controller.inc, line 97
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 addAdminLinks(&$form) {
  $form_id = $form['form_id']['#value'];
  if (variable_get('botcha_administration_mode', FALSE) && user_access('administer BOTCHA settings') && (arg(0) != 'admin' || variable_get('botcha_allow_on_admin_pages', FALSE) || $form_id == 'user_register') && $form_id != 'update_script_selection_form') {

    // Add BOTCHA administration tools.
    $botcha_element = $this
      ->createAdminLinksFieldset($form_id);

    // Get placement in form and insert in form.
    // @todo Make away with a dependency from botcha.inc.
    $botcha_placement = _botcha_get_botcha_placement($form_id, $form);
    _botcha_insert_botcha_element($form, $botcha_placement, $botcha_element);
  }
}