Skip to content

Commit

Permalink
Merge pull request #44196 from richard67/5.3-dev-upmerge-2024-10-06
Browse files Browse the repository at this point in the history
[5.2] Add active class to active item in mod_ articles #44153 
[5.2] Articles module: Truncate text (introtext and read more title) #44189
  • Loading branch information
richard67 authored Oct 6, 2024
2 parents a2a381a + 74fcef5 commit 0f4dbee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions modules/mod_articles/src/Helper/ArticlesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Joomla\CMS\Date\Date;
use Joomla\CMS\Event\Content;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\Helpers\StringHelper as SpecialStringHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
Expand Down Expand Up @@ -368,7 +367,7 @@ public function getArticles(Registry $params, SiteApplication $app)
}

if ($introtext_limit != 0) {
$item->displayIntrotext = SpecialStringHelper::truncate($item->introtext, $introtext_limit, true, false);
$item->displayIntrotext = HTMLHelper::_('string.truncateComplex', $item->displayIntrotext, $introtext_limit);
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/mod_articles/tmpl/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@
<?php echo $item->event->beforeDisplayContent; ?>

<?php if ($params->get('show_introtext', 1)) : ?>
<?php echo $item->introtext; ?>
<?php echo $item->displayIntrotext; ?>
<?php endif; ?>

<?php echo $item->event->afterDisplayContent; ?>

<?php if (isset($item->link) && $item->readmore != 0 && $params->get('show_readmore')) : ?>
<?php if ($params->get('show_readmore')) : ?>
<?php if ($params->get('show_readmore_title', '') !== '') : ?>
<?php $item->params->set('show_readmore_title', $params->get('show_readmore_title')); ?>
<?php $item->params->set('readmore_limit', $params->get('readmore_limit')); ?>
Expand Down
2 changes: 1 addition & 1 deletion modules/mod_articles/tmpl/default_titles.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ul class="mod-articles mod-list">
<?php foreach ($items as $item) : ?>
<li itemscope itemtype="https://schema.org/Article">
<a href="<?php echo $item->link; ?>" itemprop="url">
<a <?php echo $item->active ? 'class="' . $item->active . '" ' : ''; ?>href="<?php echo $item->link; ?>" itemprop="url">
<span itemprop="name">
<?php echo $item->title; ?>
</span>
Expand Down

0 comments on commit 0f4dbee

Please sign in to comment.