Ejemplo n.º 1
0
 /**
  * Constructor for the helper. Sets up the helper that is used for creating 'AJAX' links.
  *
  * Use `public $helpers = array('Paginator' => array('ajax' => 'CustomHelper'));` to set a custom Helper
  * or choose a non JsHelper Helper. If you want to use a specific library with JsHelper declare JsHelper and its
  * adapter before including PaginatorHelper in your helpers array.
  *
  * The chosen custom helper must implement a `link()` method.
  *
  * @param View $View the view object the helper is attached to.
  * @param array $settings Array of settings.
  * @throws CakeException When the AjaxProvider helper does not implement a link method.
  */
 public function __construct(View $View, $settings = array())
 {
     $ajaxProvider = isset($settings['ajax']) ? $settings['ajax'] : 'Js';
     $this->helpers[] = $ajaxProvider;
     $this->_ajaxHelperClass = $ajaxProvider;
     App::uses($ajaxProvider . 'Helper', 'View/Helper');
     $classname = $ajaxProvider . 'Helper';
     if (!class_exists($classname) || !method_exists($classname, 'link')) {
         throw new CakeException(sprintf(__d('cake_dev', '%s does not implement a link() method, it is incompatible with PaginatorHelper'), $classname));
     }
     parent::__construct($View, $settings);
 }