/**
  * Creates an HTML link.
  *
  * If $url starts with "http://" this is treated as an external link. Else,
  * it is treated as a path to controller/action and parsed with the
  * UrlHelper::url() method.
  *
  * If the $url is empty, $title is used instead.
  *
  * ### Options
  *
  * - `escape` Set to false to disable escaping of title and attributes.
  * - `escapeTitle` Set to false to disable escaping of title. Takes precedence
  *   over value of `escape`)
  * - `confirm` JavaScript confirmation message.
  *
  * @param string $title The content to be wrapped by <a> tags.
  * @param string|array $url Cake-relative URL or array of URL parameters, or
  *   external URL (starts with http://)
  * @param array $options Array of options and HTML attributes.
  * @return string An `<a />` element.
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::link
  */
 public function link($title, $url = null, array $options = array())
 {
     if (isset($options['icon'])) {
         $title = $this->icon($options['icon']) . ' ' . $title;
         unset($options['icon']);
         $options['escape'] = $options['escapeTitle'] = false;
     }
     return parent::link($title, $url, $options);
 }
 /**
  * Print a link
  * - override HtmlHelper link method
  * - Permits to put an icon in a link
  * - add a class 'activation' if the link matches the current page
  *
  * @param string $title : title of link
  * @param string $url : url
  * @param array $options : options for link
  * @return parent::link
  */
 public function link($title, $url = null, array $options = [])
 {
     $default = ['icon' => null, 'escape' => true];
     $options = array_merge($default, (array) $options);
     if ($options['icon']) {
         if ($options['escape']) {
             $title = h($title);
         }
         $title = $this->bs_icon($options['icon']) . ' ' . $title;
         $options['escape'] = false;
         unset($options['icon']);
     }
     $lang = $this->_View->request->query('lang');
     if (!isset($url['lang']) && is_array($url) && isset($lang) && !empty($lang)) {
         $url['lang'] = $lang;
     }
     // we add class = activation to a link that matches the current page
     if ($url !== null) {
         $urlRouter = $this->Url->build($url);
     }
     //debug($urlRouter);
     if ($this->_View->request->here === $urlRouter) {
         if (!empty($options['class'])) {
             $mixClasses = [$options['class'], 'activation'];
             $options['class'] = implode(' ', $mixClasses);
         } else {
             $options['class'] = 'activation';
         }
     }
     return parent::link($title, $url, $options);
 }