Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[3] Pagebreak navigation cosmetic. Icons, aria-label, title, tooltips and things" #27400

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 18 additions & 26 deletions plugins/content/pagebreak/pagebreak.php
Expand Up @@ -32,14 +32,6 @@
*/
class PlgContentPagebreak extends JPlugin
{
/**
* The navigation list with all page objects if parameter 'multipage_toc' is active.
*
* @var array
* @since __DEPLOY_VERSION__
*/
protected $list = array();

/**
* Plugin that adds a pagebreak into the text and truncates text at that point
*
Expand Down Expand Up @@ -270,6 +262,7 @@ protected function _createToc(&$row, &$matches, &$page)
$limitstart = $input->getUInt('limitstart', 0);
$showall = $input->getInt('showall', 0);
$headingtext = '';
$list = array();

if ($this->params->get('article_index', 1) == 1)
{
Expand All @@ -282,11 +275,11 @@ protected function _createToc(&$row, &$matches, &$page)
}

// TOC first Page link.
$this->list[1] = new stdClass;
$this->list[1]->liClass = ($limitstart === 0 && $showall === 0) ? 'toclink active' : 'toclink';
$this->list[1]->class = $this->list[1]->liClass;
$this->list[1]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language));
$this->list[1]->title = $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));
$list[1]->title = $heading;

$i = 2;

Expand Down Expand Up @@ -314,25 +307,24 @@ protected function _createToc(&$row, &$matches, &$page)
$title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
}

$this->list[$i] = new stdClass;
$this->list[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&limitstart=' . ($i - 1));
$this->list[$i]->title = $title;
$this->list[$i]->liClass = ($limitstart === $i - 1) ? 'active' : '';
$this->list[$i]->class = ($limitstart === $i - 1) ? 'toclink active' : 'toclink';
$list[$i] = new stdClass;
$list[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&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'))
{
$this->list[$i] = new stdClass;
$this->list[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=1');
$this->list[$i]->liClass = ($showall === 1) ? 'active' : '';
$this->list[$i]->class = ($showall === 1) ? 'toclink active' : 'toclink';
$this->list[$i]->title = JText::_('PLG_CONTENT_PAGEBREAK_ALL_PAGES');
$list[$i] = new stdClass;
$list[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=1');
$list[$i]->liClass = ($showall === 1) ? 'active' : '';
$list[$i]->class = ($showall === 1) ? 'toclink active' : 'toclink';
$list[$i]->title = JText::_('PLG_CONTENT_PAGEBREAK_ALL_PAGES');
}

$list = $this->list;
$path = JPluginHelper::getLayoutPath('content', 'pagebreak', 'toc');
ob_start();
include $path;
Expand All @@ -343,8 +335,8 @@ protected function _createToc(&$row, &$matches, &$page)
* Creates the navigation for the item
*
* @param object &$row The article object. Note $article->text is also available
* @param int $page The page number
* @param int $n The total number of pages
* @param int $page The total number of pages
* @param int $n The page number
*
* @return void
*
Expand Down
27 changes: 10 additions & 17 deletions plugins/content/pagebreak/tmpl/navigation.php
Expand Up @@ -8,31 +8,24 @@
*/

defined('_JEXEC') or die;

JHtml::_('bootstrap.tooltip');
$lang = JFactory::getLanguage();
?>
<ul>
<li>
<?php if ($links['previous']) :
$direction = $lang->isRtl() ? 'right' : 'left';
$title = htmlspecialchars($this->list[$page]->title, ENT_QUOTES, 'UTF-8');
$ariaLabel = JText::_('JPREVIOUS') . ': ' . $title . ' (' . JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', $page, $n) . ')';
?>
<a class="hasTooltip" href="<?php echo $links['previous']; ?>" title="<?php echo $title; ?>" aria-label="<?php echo $ariaLabel; ?>" rel="prev">
<?php echo '<span class="icon-chevron-' . $direction . '" aria-hidden="true"></span> ' . JText::_('JPREV'); ?>
<?php if ($links['previous']) : ?>
<a href="<?php echo $links['previous']; ?>">
<?php echo trim(str_repeat(JText::_('JGLOBAL_LT'), 2) . ' ' . JText::_('JPREV')); ?>
</a>
<?php else: ?>
<?php echo JText::_('JPREV'); ?>
<?php endif; ?>
</li>
<li>
<?php if ($links['next']) :
$direction = $lang->isRtl() ? 'left' : 'right';
$title = htmlspecialchars($this->list[$page + 2]->title, ENT_QUOTES, 'UTF-8');
$ariaLabel = JText::_('JNEXT') . ': ' . $title . ' (' . JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', ($page + 2), $n) . ')';
?>
<a class="hasTooltip" href="<?php echo $links['next']; ?>" title="<?php echo $title; ?>" aria-label="<?php echo $ariaLabel; ?>" rel="next">
<?php echo JText::_('JNEXT') . ' <span class="icon-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php if ($links['next']) : ?>
<a href="<?php echo $links['next']; ?>">
<?php echo trim(JText::_('JNEXT') . ' ' . str_repeat(JText::_('JGLOBAL_GT'), 2)); ?>
</a>
<?php else: ?>
<?php echo JText::_('JNEXT'); ?>
<?php endif; ?>
</li>
</ul>