code: public function renderSorter()
      {
          $sort = $this->dataProvider->getSort();
          if ($sort === false || empty($sort->attributes) || $this->dataProvider->getCount() <= 0) {
              return '';
          }
          /* @var $class LinkSorter */
          $sorter = $this->sorter;
          $class = ArrayHelper::remove($sorter, 'class', LinkSorter::className());
          $sorter['sort'] = $sort;
          $sorter['view'] = $this->getView();
  
          return $class::widget($sorter);
      }
docs: Renders the sorter.
  @return string the rendering result