?
avatar shionphan
shionphan
6 Dec 2017

Steps to reproduce the issue

  1. Creat any tags and assign tags to a article.
  2. Creat Fields for this article in Articles manager. (Content - Articles - Fields)
  3. Creat a menu which is 'List of items that have been tagged with the selected tags.'
  4. Set Item Description as show in menu opition List Layouts
  5. Visit this page which creating by step 3.
  6. It dose not display any Fileds.

Expected result

  1. Open file: /components/com_tags/views/tag/tmpl/default_items.php
  2. Go to line 98, see code <?php echo $item->event->beforeDisplayContent; ?>
avatar shionphan shionphan - open - 6 Dec 2017
avatar joomla-cms-bot joomla-cms-bot - change - 6 Dec 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 Dec 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Dec 2017
Category com_fields com_tags
avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Dec 2017
Title
Menu Compact list of tagged items can not display variables about $this->item->event->beforeDisplayContent;
[com_fields] Menu Compact list of tagged items can not display variables about $this->item->event->beforeDisplayContent;
avatar joomla-cms-bot joomla-cms-bot - edited - 6 Dec 2017
avatar shionphan
shionphan - comment - 6 Dec 2017

I had output in script console.log

4053aebb-3a40-40b1-89d2-38f42475d798

avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

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.

avatar shionphan shionphan - change - 6 Dec 2017
The description was changed
avatar shionphan shionphan - edited - 6 Dec 2017
avatar shionphan
shionphan - comment - 6 Dec 2017

HI, @stutteringp0et

I hav modyfied the topic which is a mistake.

  1. Creat any tags and assign tags to a article.
  2. Creat Fields for this article in Articles manager. (Content - Articles - Fields)
  3. Creat a menu which is 'List of items that have been tagged with the selected tags.'
  4. Set Item Description as show in menu opition List Layouts
  5. Visit this page which creating by step 3.
  6. 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.

avatar shionphan shionphan - change - 6 Dec 2017
The description was changed
avatar shionphan shionphan - edited - 6 Dec 2017
avatar shionphan shionphan - change - 6 Dec 2017
The description was changed
avatar shionphan shionphan - edited - 6 Dec 2017
avatar shionphan shionphan - change - 6 Dec 2017
Title
[com_fields] Menu Compact list of tagged items can not display variables about $this->item->event->beforeDisplayContent;
[com_tags] Menu Compact list of tagged items can not display variables about $this->item->event->beforeDisplayContent;
avatar shionphan shionphan - edited - 6 Dec 2017
avatar shionphan shionphan - change - 6 Dec 2017
Title
[com_tags] Menu Compact list of tagged items can not display variables about $this->item->event->beforeDisplayContent;
[com_tags] Menu List of items that have been tagged with the selected tags can not display variables about $this->item->event->beforeDisplayContent;
avatar shionphan shionphan - edited - 6 Dec 2017
avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

The list view does not display fields. Maybe someone else can explain it to you.

avatar shionphan
shionphan - comment - 6 Dec 2017

@stutteringp0et

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;
	}
}
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Dec 2017

calling @laoneo

avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Dec 2017
Status New Discussion
avatar shionphan
shionphan - comment - 6 Dec 2017

@franz-wohlkoenig

Can you tell me directly?

avatar laoneo
laoneo - comment - 6 Dec 2017

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.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Dec 2017

@shionphan I can't as i'm no Developer. @laoneo is the Developer of com_fields, thats why i called him.

avatar shionphan
shionphan - comment - 6 Dec 2017

@laoneo @franz-wohlkoenig

Thanks very much!
Thanks all!

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Dec 2017

@shionphan if this Issue is solved, please close it.

avatar shionphan
shionphan - comment - 6 Dec 2017

@laoneo

I recommend adding this feature because of tag items display articles title and articles description. It should also display articles Fields.
I dont want it for com_tags

avatar laoneo
laoneo - comment - 6 Dec 2017

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.

avatar shionphan
shionphan - comment - 6 Dec 2017

Got it.

avatar laoneo
laoneo - comment - 6 Dec 2017

Had a minute, so I created a pr. Please test #19006 which should fix the issue.

avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Dec 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-12-06 18:40:52
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 6 Dec 2017
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 6 Dec 2017
avatar joomla-cms-bot
joomla-cms-bot - comment - 6 Dec 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 6 Dec 2017

closed as having Pull Request #19006

Add a Comment

Login with GitHub to post a comment