Set plugin to afterDisplayContent event

More
10 years 11 months ago #42681 by dmayak
Hello, just want to ask for advice, I have the plugin that's working fine with Flexicontent (social share buttons plugin) but it is called on onContentAfterDisplay, so its contents outputs inside "text" field. I want to try to change it to output after all page content, since there are few other fields after text. I am using a copy of blog template and inside item template I can see
Code:
$this->item->event->afterDisplayContent;
, which I suppose is the event triggering, but changing
Code:
public function onContentAfterDisplay
to
Code:
public function afterDisplayContent
or to
Code:
public function onafterDisplayContent
seems do not trigger the plugin. Maybe I need to change the plugin group, its currently 'content'? I have looked into all FAQ entries related to plugins, but it focused on triggering plugins inside fields, not inside template.
I have also tried to trigger afterDisplayContent with JEventDispatcher, but got an error - cannot redeclare JDispatcher class. How to correctly set plugin to trigger on afterDisplayContent?

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #42696 by ggppdk
Hello

what about moving the whole output of the event inside you custom template?

1. duplicate a built-in template to create a custom template 'mydefault'

2 edit component/com_flexicontent/templates/mydefault/item.php
and copy inside item.php ... the contents of
component/com_flexicontent/tmpl_common/item_layouts/modular.php

3. continue editing item.php and move the following code:
Code:
<?php if ($item->event->afterDisplayContent) : ?> <!-- BOF afterDisplayContent --> <div class="fc_afterDisplayContent group"> <?php echo $item->event->afterDisplayContent; ?> </div> <!-- EOF afterDisplayContent --> <?php endif; ?>


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #42724 by dmayak
Thank you, this worked well with other plugins, but that one seemed to be of the kind that is added only to element text, regardless of where the event was called, although I have not found any conditions in its code. So I have abandoned it and trying to use a module instead.

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #42726 by ggppdk
Hello

- i see this a practice followed by some developers to avoid problems with template that do not print the
afterDisplayContent text



normally the afterDisplayContent() function
should do something like:
return $afterDisplayContent_text;

instead they do something like:
$item->text .= $afterDisplayContent_text;

best it would be if the developer had added a parameter for this

thanks for feedback

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 11 months ago #42830 by dmayak
Yes, you are right, now when I am understood what to look for, I have found this:
Code:
$row->text .= $html;
where $html is the main plugin output. Now I can output plugin where I need. Thank you.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.302 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline