You are here

botcha.application.controller.d7adapter.not_needed_yet.inc in BOTCHA Spam Prevention 7.4

File

controller/application/decorator/d7adapter/botcha.application.controller.d7adapter.not_needed_yet.inc
View source
<?php

/**
 * This adapter will become useful when D8 gets released. Until that, it is not
 * needed at all and the module works without any adapter at all.
 *
 * @todo Add interface and make this class implemented.
 * @todo Extract common DrupalD7Adapter.
 */

/* @todo Create real D7 adapter when D8 gets released.
class BotchaD7Adapter extends ApplicationAdapter /*implements IBotcha*\/ {
  const ADMIN_PATH = 'admin/config/people/botcha';
  const PEOPLE_PATH = 'admin/people';
  const PERMISSIONS_PATH = 'admin/people/permissions';
  // Form ID of comment form on standard (page) node.
  const COMMENT_FORM_ID = 'comment_node_page_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;
  }
}
 *
 */