Search
Other Articles Field questions
Forum

Check if articlesLinked Field is empty

Husi's Avatar Husi
CustomField Id 29 is a RegularLabs field type "articleslinked"

At Template-Override I want to check, if this article is linked or not.
For this I use the VALUE like
$this->item->jcfields[29]->value

For checking, if there is a value, in Joomla! 4.x I used

$check 	= $this->item->jcfields[29]->value;
if ($check 	== "") {
	...
}

After updating to Joomla!5.0.0 this doesn´t work anymore.

Doing a
var_dump($this->item->jcfields[29]);
in Joomla4 without a linkedArticle, it was this:
["value"]=> string(0) "" ["rawvalue"]=> string(1) "1" }
in joomla5 it is this:
["value"]=> string(43) " " ["rawvalue"]=> string(1) "1" }


But whatever I try now ... I am not able to check any more with an if

Can you please help me?

Thanks
Carsten
Peter van Westen's Avatar Peter van Westen ADMIN
$check 	= trim($this->item->jcfields[29]->value);
if ($check == "") {
	...
}
Please post a rating at the Joomla! Extensions Directory
Husi's Avatar Husi
This works. Thanks for the hint!
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription