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
[com_tags] Menu List of items that have been tagged with the selected tags can not display variables about $this->item->event->beforeDisplayContent; #18992
Comments
how/why is this com_fields? the events you have listed contain potential output of Joomla content plugins. If you don't have a plugin that injects afterDisplayTitle content - that property will be empty. Normally those are displayed for articles - but they can run in any context, and it's up to the template to render the data if it exists. I'm looking at the /components/com_tags/views/tag/tmpl/list.php and list_items.php and those pages don't run content plugins on anything but the page description. Now, if I look at /components/com_tags/views/tag/tmpl/default.php and default_items.php - that's a different story. Those templates run content plugins on the title, the description, the tag list description... I don't think lists are ever meant to have plugin events for each item. |
HI, @stutteringp0et I hav modyfied the topic which is a mistake.
The Fields for article can not display in tags components page . We know that Fileds was content plugin for articles. |
The list view does not display fields. Maybe someone else can explain it to you. |
But I have found the code in foreach ($items as $itemElement)
{
$itemElement->event = new stdClass;
// For some plugins.
!empty($itemElement->core_body)? $itemElement->text = $itemElement->core_body : $itemElement->text = null;
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentPrepare', array ('com_tags.tag', &$itemElement, &$itemElement->core_params, 0));
$results = $dispatcher->trigger('onContentAfterTitle', array('com_tags.tag', &$itemElement, &$itemElement->core_params, 0));
$itemElement->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_tags.tag', &$itemElement, &$itemElement->core_params, 0));
$itemElement->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_tags.tag', &$itemElement, &$itemElement->core_params, 0));
$itemElement->event->afterDisplayContent = trim(implode("\n", $results));
// Write the results back into the body
if (!empty($itemElement->core_body))
{
$itemElement->core_body = $itemElement->text;
}
} |
calling @laoneo |
@franz-wohlkoenig Can you tell me directly? |
The important thing here is the context. When you want to get the fields for articles, you need the context com_content.article. We are working here with tags ('com_tags.tag') which are different objects. If tags itself (you can create custom fields for a tag) would support custom fields, then they would get displayed. When you want the custom fields for an article, you need to create an override of the view and then fetch the fields for the article trough the FieldsHelper::getFields() function. |
@shionphan I can't as i'm no Developer. @laoneo is the Developer of com_fields, thats why i called him. |
@laoneo @franz-wohlkoenig Thanks very much! |
@shionphan if this Issue is solved, please close it. |
I recommend adding this feature because of tag items display articles title and articles description. It should also display articles Fields. |
I quickly debugged the code, and we would have all relevant information which is needed for com_fields. So I suggest to leave this issue open till somebody comes up with a pr. |
Got it. |
Had a minute, so I created a pr. Please test #19006 which should fix the issue. |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/18992 |
closed as having Pull Request #19006 |
Steps to reproduce the issue
Expected result
/components/com_tags/views/tag/tmpl/default_items.php
<?php echo $item->event->beforeDisplayContent; ?>
The text was updated successfully, but these errors were encountered: