Create an article with an Intro Image, without Caption
View the font-end
NO warning
Warn about image_intro_caption
Joomla 4.0 Beta 1
In /layouts/joomla/content/intro_image.php
the cose is:
<?php if ($images->image_intro_caption !== '') : ?>
<figcaption class="caption"><?php echo htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
<?php endif; ?>
I suggest change the code with:
<?php if (!empty($images->image_intro_caption)) : ?>
<figcaption class="caption"><?php echo htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
<?php endif; ?>
Labels |
Added:
?
|
@infograf768 Do you wanna make a new PR?
Please do. ;)
I don't have time before late evening today or even tomorrow.
@SharkyKZ
The code was done this way after your suggestion:
#20503 (comment)
Quid?
Also, I can't confirm the error at all
I haven't tested yet if I can confirm the issue.
My guess this occurs when creating articles programmatically (e.g. using the API) and not providing some fields. I guess we can fix this. But then there's more places like this, e.g. URLs in articles.
API and I are long time enemies. Can't help here.
Some one has to test using API.
With API testing I am a bit familiar meanwhile, so if someone makes a PR I can test later tonight or tomorrow.
Yes, I have created the article with API
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-06-08 20:13:40 |
Closed_By | ⇒ | SharkyKZ |
@infograf768 I think @Razzo1987 is right here, and both changes from your PR #20503 should be modified from
if ($images->image_fulltext_caption !== '')
toif (!empty($images->image_intro_caption))
.As as I understand the type safe comparison
!==
, it is true if the values or the data types are different. Asnull
is a separate data type in PHP, this would only result in true if the value is an empty string, but not if the value is null. But!empty()
covers both, not null and not empty string.