original_string: public function addColumn($name, $title = null, $buttontext = null, $grid = null)
      {
          if ($grid === null) {
              $grid = $this->owner;
          }
          /** @type Grid $this->owner */
          /** @type Grid $grid */
  
          if (!is_array($buttontext)) {
              $buttontext = array('descr' => $buttontext);
          }
          if (!$buttontext['descr']) {
              $buttontext['descr'] = $title ?: ucwords(str_replace('_', ' ', $name));
          }
  
          $icon = '';
          if ($buttontext['icon']) {
              if ($buttontext['icon'][0] != '<') {
                  $icon .= '<i class="icon-'.$buttontext['icon'].'"></i>';
              } else {
                  $icon .= $buttontext['icon'];
              }
              $icon .= '&nbsp;';
          }
  
          $grid->addColumn('template', $name, $buttontext ?: $title);
          $grid->setTemplate(
              '<button type="button" class="atk-button-small pb_'.$name.'">'.
                  $icon.$this->app->encodeHtmlChars($buttontext['descr']).
              '</button>'
          );
  
          $grid->columns[$name]['thparam'] .= ' style="width: 40px; text-align: center"';
  
          //$grid->js(true)->_selector('#'.$grid->name.' .pb_'.$name)->button();
          $t = $this->type;
          $grid->js('click')->_selector('#'.$grid->name.' .pb_'.$name)->univ()
              ->$t($title, array($this->getURL($name),
                  $this->name.'_id' => $grid->js()->_selectorThis()->closest('tr')->attr('data-id'),
              ), $this->frame_options);
  
          return $this;
      }
code: public function addColumn($name, $title = null, $buttontext = null, $grid = null)
      {
          if ($grid === null) {
              $grid = $this->owner;
          }
          /** @type Grid $this->owner */
          /** @type Grid $grid */
  
          if (!is_array($buttontext)) {
              $buttontext = array('descr' => $buttontext);
          }
          if (!$buttontext['descr']) {
              $buttontext['descr'] = $title ?: ucwords(str_replace('_', ' ', $name));
          }
  
          $icon = '';
          if ($buttontext['icon']) {
              if ($buttontext['icon'][0] != '<') {
                  $icon .= '<i class="icon-'.$buttontext['icon'].'"></i>';
              } else {
                  $icon .= $buttontext['icon'];
              }
              $icon .= '&nbsp;';
          }
  
          $grid->addColumn('template', $name, $buttontext ?: $title);
          $grid->setTemplate(
              '<button type="button" class="atk-button-small pb_'.$name.'">'.
                  $icon.$this->app->encodeHtmlChars($buttontext['descr']).
              '</button>'
          );
  
          $grid->columns[$name]['thparam'] .= ' style="width: 40px; text-align: center"';
  
          //$grid->js(true)->_selector('#'.$grid->name.' .pb_'.$name)->button();
          $t = $this->type;
          $grid->js('click')->_selector('#'.$grid->name.' .pb_'.$name)->univ()
              ->$t($title, array($this->getURL($name),
                  $this->name.'_id' => $grid->js()->_selectorThis()->closest('tr')->attr('data-id'),
              ), $this->frame_options);
  
          return $this;
      }
code_tokens: public function addColumn ( $ name , $ title = null , $ buttontext = null , $ grid = null ) { if ( $ grid === null ) { $ grid = $ this -> owner ; } /** @type Grid $this->owner */ /** @type Grid $grid */ if ( ! is_array ( $ buttontext ) ) { $ buttontext = array ( 'descr' => $ buttontext ) ; } if ( ! $ buttontext [ 'descr' ] ) { $ buttontext [ 'descr' ] = $ title ? : ucwords ( str_replace ( '_' , ' ' , $ name ) ) ; } $ icon = '' ; if ( $ buttontext [ 'icon' ] ) { if ( $ buttontext [ 'icon' ] [ 0 ] != '<' ) { $ icon .= '<i class="icon-' . $ buttontext [ 'icon' ] . '"></i>' ; } else { $ icon .= $ buttontext [ 'icon' ] ; } $ icon .= '&nbsp;' ; } $ grid -> addColumn ( 'template' , $ name , $ buttontext ? : $ title ) ; $ grid -> setTemplate ( '<button type="button" class="atk-button-small pb_' . $ name . '">' . $ icon . $ this -> app -> encodeHtmlChars ( $ buttontext [ 'descr' ] ) . '</button>' ) ; $ grid -> columns [ $ name ] [ 'thparam' ] .= ' style="width: 40px; text-align: center"' ; //$grid->js(true)->_selector('#'.$grid->name.' .pb_'.$name)->button(); $ t = $ this -> type ; $ grid -> js ( 'click' ) -> _selector ( '#' . $ grid -> name . ' .pb_' . $ name ) -> univ ( ) -> $ t ( $ title , array ( $ this -> getURL ( $ name ) , $ this -> name . '_id' => $ grid -> js ( ) -> _selectorThis ( ) -> closest ( 'tr' ) -> attr ( 'data-id' ) , ) , $ this -> frame_options ) ; return $ this ; }
docstring: Call this if you are adding this inside a grid.
  
  @param string $name             Field Name (must not contain spaces)
  @param string $title            Header for the column
  @param array|string $buttontext Text to put on the button
  @param Grid $grid               Specify grid to use, other than $owner
  
  @return $this
docstring_tokens: Call this if you are adding this inside a grid .