You are here

class BotchaD6Adapter in BOTCHA Spam Prevention 6.4

Hierarchy

Expanded class hierarchy of BotchaD6Adapter

File

controller/application/decorator/d6adapter/botcha.application.controller.d6adapter.inc, line 11

View source
class BotchaD6Adapter extends ApplicationAdapter {
  const ADMIN_PATH = 'admin/user/botcha';
  const PEOPLE_PATH = 'admin/user';
  const PERMISSIONS_PATH = 'admin/user/permissions';

  // Form ID of comment form on standard (page) node.
  const COMMENT_FORM_ID = 'comment_form';

  // Controllers.
  const CONTROLLER_TYPE_FORM = 'Form';
  const CONTROLLER_TYPE_RECIPE = 'Recipe';
  const CONTROLLER_TYPE_RECIPEBOOK = 'Recipebook';
  protected $ctrls = array(
    self::CONTROLLER_TYPE_FORM,
    self::CONTROLLER_TYPE_RECIPE,
    self::CONTROLLER_TYPE_RECIPEBOOK,
  );
  protected $app_name = 'Botcha';

  /**
   * Hook implementations.
   */
  public function form_alter(&$form, &$form_state, $form_id) {
    $this->original
      ->form_alter($form, $form_state, $form_id);
  }
  public function help($path, $arg) {
    return $this->original
      ->help($path, $arg);
  }
  public function menu() {
    $menus = $this->original
      ->menu();
    foreach ($menus as $menu) {
      switch ($menu['type']) {
        case MENU_LOCAL_TASK:
          $menu['type'] = MENU_LOCAL_TASK + MENU_NORMAL_ITEM;
          break;
        case MENU_LOCAL_ACTION:

          // @todo It is not fair replacement: invent how to move nice link from hook_theme implementation.
          $menu['type'] = MENU_CALLBACK;
      }
    }
    return $menus;
  }
  public function perm() {
    $perms = array();
    $permissions = $this->original
      ->permission();
    $perms = array_keys($permissions);
    return $perms;
  }
  public function recipebook_title($recipebook) {
    return $this->original
      ->recipebook_title($recipebook);
  }

  /**
   * Necessary Botcha functions.
   */
  public function getAdminForm(&$form_state, $form_name) {
    $form = array();
    $args = func_get_args();
    $object_to_edit = isset($args[2]) ? $args[2] : NULL;
    return $this->original
      ->getAdminForm($form, $form_state, $form_name, $object_to_edit);
  }
  public function submitAdminForm($form, &$form_state) {
    $this->original
      ->submitAdminForm($form, $form_state);
  }
  public function generateSecretKey() {
    return $this->original
      ->generateSecretKey();
  }
  public function formExists($value) {
    return $this->original
      ->formExists($value);
  }
  public function recipebookExists($value) {
    return $this->original
      ->recipebookExists($value);
  }
  public function formValidate($form, &$form_state) {
    $this->original
      ->formValidate($form, $form_state);
  }

  // @todo Refactor it: turn into specification.
  public function admin_path() {
    return self::ADMIN_PATH;
  }
  public function people_path() {
    return self::PEOPLE_PATH;
  }
  public function permissions_path() {
    return self::PERMISSIONS_PATH;
  }

}

Members