original_string: public function addMenu($options = array(), $vertical = false)
      {
          $this->options['icons']['secondary'] = $this->js_triangle_class;
  
          // add menu
          $this->menu = $this->owner->add($this->menu_class, $options, $this->spot);
          /** @type Menu_jUI $this->menu */
          $this->menu->addStyle('display', 'none');
  
          // show/hide menu on button click
          $this->js('click', array(
              $this->js()
                  ->toggleClass($this->js_active_class),
              $this->menu->js()
                  ->toggle()
                  ->position($this->getPosition($vertical)),
          ));
  
          // hide menu on clicking outside of menu
          $this->js(true)->_selectorDocument()->bind(
              'click',
              $this->js(null, array(
                  $this->js()->removeClass($this->js_active_class),
                  $this->menu->js()->hide(),
              ))->_enclose()
          );
  
          return $this->menu;
      }
code: public function addMenu($options = array(), $vertical = false)
      {
          $this->options['icons']['secondary'] = $this->js_triangle_class;
  
          // add menu
          $this->menu = $this->owner->add($this->menu_class, $options, $this->spot);
          /** @type Menu_jUI $this->menu */
          $this->menu->addStyle('display', 'none');
  
          // show/hide menu on button click
          $this->js('click', array(
              $this->js()
                  ->toggleClass($this->js_active_class),
              $this->menu->js()
                  ->toggle()
                  ->position($this->getPosition($vertical)),
          ));
  
          // hide menu on clicking outside of menu
          $this->js(true)->_selectorDocument()->bind(
              'click',
              $this->js(null, array(
                  $this->js()->removeClass($this->js_active_class),
                  $this->menu->js()->hide(),
              ))->_enclose()
          );
  
          return $this->menu;
      }
code_tokens: public function addMenu ( $ options = array ( ) , $ vertical = false ) { $ this -> options [ 'icons' ] [ 'secondary' ] = $ this -> js_triangle_class ; // add menu $ this -> menu = $ this -> owner -> add ( $ this -> menu_class , $ options , $ this -> spot ) ; /** @type Menu_jUI $this->menu */ $ this -> menu -> addStyle ( 'display' , 'none' ) ; // show/hide menu on button click $ this -> js ( 'click' , array ( $ this -> js ( ) -> toggleClass ( $ this -> js_active_class ) , $ this -> menu -> js ( ) -> toggle ( ) -> position ( $ this -> getPosition ( $ vertical ) ) , ) ) ; // hide menu on clicking outside of menu $ this -> js ( true ) -> _selectorDocument ( ) -> bind ( 'click' , $ this -> js ( null , array ( $ this -> js ( ) -> removeClass ( $ this -> js_active_class ) , $ this -> menu -> js ( ) -> hide ( ) , ) ) -> _enclose ( ) ) ; return $ this -> menu ; }
docstring: Show menu when clicked. For example, dropdown menu.
  
  @param array $options  Options to pass to Menu class
  @param bool  $vertical Direction of menu (false=horizontal, true=vertical)
  
  @return Menu
docstring_tokens: Show menu when clicked . For example dropdown menu .