diff --git a/plugins/content/pagebreak/pagebreak.php b/plugins/content/pagebreak/pagebreak.php
index 4ba66411dcaa1..9fe03f0b8ad14 100644
--- a/plugins/content/pagebreak/pagebreak.php
+++ b/plugins/content/pagebreak/pagebreak.php
@@ -252,15 +252,14 @@ public function onContentPrepare($context, &$row, &$params, $page = 0)
*/
protected function _createToc(&$row, &$matches, &$page)
{
- $heading = isset($row->title) ? $row->title : JText::_('PLG_CONTENT_PAGEBREAK_NO_TITLE');
- $input = JFactory::getApplication()->input;
- $limitstart = $input->getUInt('limitstart', 0);
- $showall = $input->getInt('showall', 0);
-
- // TOC header.
- $row->toc = '
';
-
- if ($this->params->get('article_index') == 1)
+ $heading = isset($row->title) ? $row->title : JText::_('PLG_CONTENT_PAGEBREAK_NO_TITLE');
+ $input = JFactory::getApplication()->input;
+ $limitstart = $input->getUInt('limitstart', 0);
+ $showall = $input->getInt('showall', 0);
+ $headingtext = '';
+ $list = array();
+
+ if ($this->params->get('article_index', 1) == 1)
{
$headingtext = JText::_('PLG_CONTENT_PAGEBREAK_ARTICLE_INDEX');
@@ -268,26 +267,19 @@ protected function _createToc(&$row, &$matches, &$page)
{
$headingtext = htmlspecialchars($this->params->get('article_index_text'), ENT_QUOTES, 'UTF-8');
}
-
- $row->toc .= '
' . $headingtext . '
';
}
// TOC first Page link.
- $class = ($limitstart === 0 && $showall === 0) ? 'toclink active' : 'toclink';
- $row->toc .= '
- -
- ' . $heading . '
-
- ';
+ $list[1] = new stdClass;
+ $list[1]->liClass = ($limitstart === 0 && $showall === 0) ? 'toclink active' : 'toclink';
+ $list[1]->class = $list[1]->liClass;
+ $list[1]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=&limitstart=');
+ $list[1]->title = $heading;
$i = 2;
foreach ($matches as $bot)
{
- $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=&limitstart=' . ($i - 1));
-
if (@$bot[0])
{
$attrs2 = JUtility::parseAttributes($bot[0]);
@@ -310,22 +302,28 @@ protected function _createToc(&$row, &$matches, &$page)
$title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
}
- $liClass = ($limitstart === $i - 1) ? ' class="active"' : '';
- $class = ($limitstart === $i - 1) ? 'toclink active' : 'toclink';
- $row->toc .= '- ' . $title . '
';
+ $list[$i] = new stdClass;
+ $list[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=&limitstart=' . ($i - 1));
+ $list[$i]->title = $title;
+ $list[$i]->liClass = ($limitstart === $i - 1) ? 'active' : '';
+ $list[$i]->class = ($limitstart === $i - 1) ? 'toclink active' : 'toclink';
+
$i++;
}
if ($this->params->get('showall'))
{
- $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=1&limitstart=');
- $liClass = ($limitstart === $i - 1) ? ' class="active"' : '';
- $class = ($limitstart === $i - 1) ? 'toclink active' : 'toclink';
- $row->toc .= '- '
- . JText::_('PLG_CONTENT_PAGEBREAK_ALL_PAGES') . '
';
+ $list[$i] = new stdClass;
+ $list[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=1&limitstart=');
+ $list[$i]->liClass = ($showall === 1) ? 'active' : '';
+ $list[$i]->class = ($showall === 1) ? 'toclink active' : 'toclink';
+ $list[$i]->title = JText::_('PLG_CONTENT_PAGEBREAK_ALL_PAGES');
}
- $row->toc .= '
';
+ $path = JPluginHelper::getLayoutPath('content', 'pagebreak', 'toc');
+ ob_start();
+ include $path;
+ $row->toc = ob_get_clean();
}
/**
diff --git a/plugins/content/pagebreak/tmpl/toc.php b/plugins/content/pagebreak/tmpl/toc.php
new file mode 100644
index 0000000000000..9d68cb0ff8452
--- /dev/null
+++ b/plugins/content/pagebreak/tmpl/toc.php
@@ -0,0 +1,28 @@
+
+