public function getLegend()
 {
     $legend = parent::getLegend();
     $element = $this->getElement();
     $view = $element->getView();
     $buttons = $this->getLegendButtons();
     if (!is_null($buttons) && !is_array($buttons)) {
         $buttons = array($buttons);
     }
     $markup = '';
     if (!is_null($buttons) && count($buttons) >= 1) {
         $markup .= '<span class="button-group">';
         foreach ($buttons as $button) {
             $button = $element->getElement($button);
             if (!is_null($button)) {
                 $markup .= $this->renderButton($button);
             }
         }
         $markup .= '</span>';
     }
     return $legend . $markup;
 }