Skip to Content Skip to Menu

[SOLVED] Using Joomla! Events in CB Auto Actions

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
6 years 6 months ago - 6 years 6 months ago #303944 by bascherz
I had the fortune today of needing one of the provided Joomla! events to create an Auto Action. Perhaps the GOOD fortune of not really needing any of the parameters passed into a plugin triggered off that event. But it raised the question: What if I needed to access the parameters? Can I?

The event I used is joomla_onContentAfterDisplay, which has the following interface:
  • context - The context of the content being passed to the plugin - this is the component name and view - or name of module (e.g. com_content.article). Use this to check whether you are in the desired context for the plugin.
  • & article - The article that is being rendered by the view.
  • & params - A JRegistry object of merged article and menu item params.
  • limitstart - An integer that determines the "page" of the content that is to be generated.
Is this documented somewhere? I searched for joomla_on and found nothing relevant.

If I were writing a plugin for this Joomla! event, I could get to the article title, for example, with $article->title. How would I get to that in my Auto-Action? Would I need to use a Code action and could I just use that type of reference? How about if I needed a non-Code action? Can it be used in a substitution-style syntax, perhaps something like [article->title]?

Thanks,
Bruce

Bruce S - Vienna, VA
Last edit: 6 years 6 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 6 months ago #303956 by krileon
Replied by krileon on topic Using Joomla! Events in CB Auto Actions

But it raised the question: What if I needed to access the parameters? Can I?

Yes, you access them the same way you would with CB triggers using var1, var2, etc..

Is this documented somewhere? I searched for joomla_on and found nothing relevant.

Joomla events are documented in Joomla documentation.

How would I get to that in my Auto-Action?

Since $article is the second variable of the event you'd access it with [var2], but since it's an object you'd need to access its properties. For title specifically you'd use [var2_title].

Would I need to use a Code action and could I just use that type of reference?

You can access them from a Code action using the $variables variable. So for example $variables->title for article title. You're not required to use a code action as they can be substituted fine (see above quote). If you need to modify the variables by reference you can do so from a Code action our the Output after setting the appropriate variable as a reference variable under the parameters tab.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
6 years 6 months ago - 6 years 6 months ago #303958 by bascherz
Replied by bascherz on topic Using Joomla! Events in CB Auto Actions
Thanks, Kyle. You da man!

Bruce

Bruce S - Vienna, VA
Last edit: 6 years 6 months ago by bascherz.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum