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
[mod_articles_news] Option Intro/Full Images of the article #20169
[mod_articles_news] Option Intro/Full Images of the article #20169
Conversation
Option to use or not, the intro image field or the full image field of the article
modules/mod_articles_news/helper.php
Outdated
{ | ||
$item->imageSrc = htmlspecialchars($images->image_intro, ENT_COMPAT, 'UTF-8'); | ||
$item->imageAlt = htmlspecialchars($images->image_intro_alt, ENT_COMPAT, 'UTF-8'); | ||
if ($images->image_intro_caption) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add blank line above.
modules/mod_articles_news/helper.php
Outdated
{ | ||
$item->imageSrc = htmlspecialchars($images->image_fulltext, ENT_COMPAT, 'UTF-8'); | ||
$item->imageAlt = htmlspecialchars($images->image_fulltext_alt, ENT_COMPAT, 'UTF-8'); | ||
if ($images->image_intro_caption) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add blank line above.
modules/mod_articles_news/helper.php
Outdated
$item->imageCaption = htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8'); | ||
} | ||
} | ||
else if ($params->get('image') == "full" && isset($images->image_fulltext) && !empty($images->image_fulltext)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to elseif
. Change "
to '
. Change ==
to ===
.
modules/mod_articles_news/helper.php
Outdated
{ | ||
$item->introtext = preg_replace('/<img[^>]*>/', '', $item->introtext); | ||
$images = json_decode($item->images); | ||
$item->imageSrc = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change ""
to ''
modules/mod_articles_news/helper.php
Outdated
@@ -119,9 +119,32 @@ public static function getList(&$params) | |||
|
|||
$item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_articles_news.content'); | |||
|
|||
if (!$params->get('image')) | |||
// Get the data of the image, if it is going to be shown | |||
if ($params->get('image') != "none") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change "
to '
modules/mod_articles_news/helper.php
Outdated
$item->imageSrc = ""; | ||
$item->imageAlt = ""; | ||
$item->imageCaption = ""; | ||
if ($params->get('image') == "intro" && isset($images->image_intro) && !empty($images->image_intro)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change "
to '
. Change ==
to ===
.
modules/mod_articles_news/helper.php
Outdated
{ | ||
$item->imageCaption = htmlspecialchars($images->image_fulltext_caption, ENT_COMPAT, 'UTF-8'); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove blank line.
label="MOD_ARTICLES_NEWS_FIELD_IMAGES_LABEL" | ||
description="MOD_ARTICLES_NEWS_FIELD_IMAGES_DESC" | ||
class="btn-group btn-group-yesno" | ||
default="0" | ||
default="1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was a mistake. Now is okay
@@ -30,6 +30,8 @@ MOD_ARTICLES_NEWS_FIELD_TRIGGEREVENTS_DESC="Triggers additional plugin events to | |||
MOD_ARTICLES_NEWS_FIELD_TRIGGEREVENTS_LABEL="Trigger Plugin Events" | |||
MOD_ARTICLES_NEWS_FIELD_SHOWINTROTEXT_DESC="Show or hide the article intro text." | |||
MOD_ARTICLES_NEWS_FIELD_SHOWINTROTEXT_LABEL="Show Intro Text" | |||
MOD_ARTICLES_NEWS_OPTION_INTROIMAGE="Intro image" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to Image
<figure class="newsflash-image"> | ||
<img src="<?php echo $item->imageSrc;?>" alt="<?php echo $item->imageAlt;?>"> | ||
<figcaption> | ||
<?php echo $item->imageCaption;?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add space after ;
@@ -22,6 +22,15 @@ | |||
</<?php echo $item_heading; ?>> | |||
<?php endif; ?> | |||
|
|||
<?php if ($params->get('image') != "none" && !empty($item->imageSrc)) : ?> | |||
<figure class="newsflash-image"> | |||
<img src="<?php echo $item->imageSrc;?>" alt="<?php echo $item->imageAlt;?>"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add space after ;
@@ -22,6 +22,15 @@ | |||
</<?php echo $item_heading; ?>> | |||
<?php endif; ?> | |||
|
|||
<?php if ($params->get('image') != "none" && !empty($item->imageSrc)) : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change "
to '
Is done, thank you @Quy |
Fixed default attribute of the image field inside the xml file. Added a condition in case the caption of the image is empty, for no show unnecessarily the figcaption tag
I have tested this item ✅ successfully on a3b2f08 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20169. |
I have tested this item ✅ successfully on a3b2f08 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20169. |
Ready to Commit after two successful tests. |
modules/mod_articles_news/helper.php
Outdated
$item->imageSrc = ''; | ||
$item->imageAlt = ''; | ||
$item->imageCaption = ''; | ||
if ($params->get('image') === 'intro' && isset($images->image_intro) && !empty($images->image_intro)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add blank line above.
<?php if ($params->get('image') != 'none' && !empty($item->imageSrc)) : ?> | ||
<figure class="newsflash-image"> | ||
<img src="<?php echo $item->imageSrc; ?>" alt="<?php echo $item->imageAlt; ?>"> | ||
<?php if(!empty($item->imageCaption)) : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add space after if
<option value="0">JNO</option> | ||
<option value="intro">MOD_ARTICLES_NEWS_OPTION_INTROIMAGE</option> | ||
<option value="full">MOD_ARTICLES_NEWS_OPTION_FULLIMAGE</option> | ||
<option value="null">JNO</option> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to none
?
Thank you again @Quy . I need have more careful with this small things. |
I have tested this item ✅ successfully on 68e2e54 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20169. |
@@ -7,8 +7,8 @@ MOD_ARTICLES_NEWS="Articles - Newsflash" | |||
MOD_ARTICLES_NEWS_FIELD_FEATURED_DESC="Show or hide articles marked as featured." | |||
MOD_ARTICLES_NEWS_FIELD_FEATURED_LABEL="Featured Articles" | |||
MOD_ARTICLES_NEWS_FIELD_CATEGORY_DESC="Select Articles from a specific Category or a set of Categories. If no selection will show all categories as default." | |||
MOD_ARTICLES_NEWS_FIELD_IMAGES_ARTICLE_DESC="Display article intro or full image." | |||
MOD_ARTICLES_NEWS_FIELD_IMAGES_ARTICLE_LABEL="Show Intro-Full Image" | |||
MOD_ARTICLES_NEWS_FIELD_IMAGES_ARTICLE_DESC="Display article, intro or full image." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brianteeman help pls.
I don't think that the comma is correct here. The string should describe something like:
"Show the intro image or the full image that you selected in the article"
but not
"Show article image or the intro image or the full image"
(for the images inside article text we have another setting)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I thought it was display article or intro or full
in this context the word article is not needed and as you can see fro my error it can be misleading
i dont think we ever refer to them as article images any way so
why not simply say
Display the intro or full image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote the "article" word, trying not to confuse the one who reads it, with the other param. "Intro image" and "Full image", are well known, but include the "article" word, I think it locates better which fields we're talking about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow or other but the comma is wrong. I myself would prefer a description without "article" here. For me an "article" image (inside the editor text) is distinct from an "intro" image is distinct from a "full" image. The description would be clearer for me as a not native English speaker.
Ok done. Hope is better now. |
I have tested this item ✅ successfully on 5efd862 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20169. |
1 similar comment
I have tested this item ✅ successfully on 5efd862 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20169. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20169. |
Please help (my Joomla's up to date): What I found out - sorry, I'm not a programmer: In the options field there's an english-german language mixup - see the screenshot: I only found the german translation file de-DE_mod_articles-news_ini where the following lines are missing: Thanks for your patience! |
Pull Request for Issue #19599 , #16495
Summary of Changes
Option to use or not, the intro image field or the full image field of the article
Testing Instructions
Expected result
The module shows or not, the fields "Intro image" or "Full article image" of the article correctly
Actual result
The current option only display images in the article context.
Documentation Changes Required
New module option added.