/**
  * @param $matches array
  * @return string
  */
 private function headingTransformCallbackXHTML($matches)
 {
     wfProfileIn(__METHOD__);
     if (isset($matches[0])) {
         preg_match('/id="([^"]*)"/', $matches[0], $headlineMatches);
     }
     $headlineId = isset($headlineMatches[1]) ? $headlineMatches[1] : '';
     static $headings = 0;
     $show = self::$messages['mobile-frontend-show-button'];
     $hide = self::$messages['mobile-frontend-hide-button'];
     $backToTop = self::$messages['mobile-frontend-back-to-top-of-section'];
     ++$headings;
     // Back to top link
     $base = Html::openElement('div', array('id' => 'anchor_' . intval($headings - 1), 'class' => 'section_anchors')) . Html::rawElement('a', array('href' => '#section_' . intval($headings - 1), 'class' => 'back_to_top'), '↑' . $backToTop) . Html::closeElement('div');
     // generate the HTML we are going to inject
     $buttons = Html::element('button', array('class' => 'section_heading show', 'section_id' => $headings), $show) . Html::element('button', array('class' => 'section_heading hide', 'section_id' => $headings), $hide);
     if (self::$device['supports_javascript']) {
         $h2OnClick = 'javascript:wm_toggle_section(' . $headings . ');';
         $base .= Html::openElement('h2', array('class' => 'section_heading', 'id' => 'section_' . $headings, 'onclick' => $h2OnClick));
     } else {
         $base .= Html::openElement('h2', array('class' => 'section_heading', 'id' => 'section_' . $headings));
     }
     $base .= $buttons . Html::rawElement('span', array('id' => $headlineId), $matches[2]) . Html::closeElement('h2') . Html::openElement('div', array('class' => 'content_block', 'id' => 'content_' . $headings));
     if ($headings > 1) {
         // Close it up here
         $base = Html::closeElement('div') . $base;
     }
     self::$headings = $headings;
     wfProfileOut(__METHOD__);
     return $base;
 }