/components/com_tags/views/tag/tmpl/default_items.php
<?php echo $item->event->beforeDisplayContent; ?>
Labels |
Added:
?
|
Category | ⇒ | com_fields com_tags |
Title |
|
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.
- Creat any tags and assign tags to a article.
- Creat Fields for this article in Articles manager. (Content - Articles - Fields)
- Creat a menu which is 'List of items that have been tagged with the selected tags.'
- Set Item Description as show in menu opition List Layouts
- Visit this page which creating by step 3.
- It dose not display any Fileds.
The Fields for article can not display in tags components page . We know that Fileds was content plugin for articles.
Title |
|
Title |
|
The list view does not display fields. Maybe someone else can explain it to you.
But I have found the code in components/com_tags/views/view.html.php
, go to line 90.
I thinks it was for content plugins, EX. Fields.
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;
}
}
Status | New | ⇒ | Discussion |
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.
Thanks very much!
Thanks all!
@shionphan if this Issue is solved, please close it.
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.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-12-06 18:40:52 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/18992
I had output in script console.log