code: protected function renderBeforeItem($model, $key, $index)
      {
          if ($this->beforeItem instanceof Closure) {
              return call_user_func($this->beforeItem, $model, $key, $index, $this);
          }
  
          return null;
      }
docs: Calls [[beforeItem]] closure, returns execution result.
  If [[beforeItem]] is not a closure, `null` will be returned.
  
  @param mixed $model the data model to be rendered
  @param mixed $key the key value associated with the data model
  @param int $index the zero-based index of the data model in the model array returned by [[dataProvider]].
  @return string|null [[beforeItem]] call result or `null` when [[beforeItem]] is not a closure
  @see beforeItem
  @since 2.0.11