Option to show or hide register button for each menu item

  • Javier Llamazares
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #134399 by Javier Llamazares
Hi,

I would like to be able to customize event timeline view so that, for each menu item using timeline view you can choose whether you want to show the register button or not.

I am aware you can configure hiding the register button in EB Configuration / Themes /
Show Register Buttons, but this would hide the register button everywhere, and this is not what I'm trying to achieve: I would like to show the button for certain menus but not for others.

===

So far I have added a new option at:
Code:
components/com_eventbooking/view/upcomingevents/tmpl/timeline.xml
Code:
<field name="hide_register_button_for_menu" type="list" default="0" label="Hide Register Button" description="Choose to show/hide register button for this menu item"> <option value="0">No</option> <option value="1">Yes</option> </field>

Which correctly shows the option for the menu item.

Can you point met to which files I should modify to add this functionality?

Many thanks!

Javi




I know you can choose not

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

More
3 years 11 months ago #134425 by Tuan Pham Ngoc
Hi Javi

If you want to perform that customization, you will need to edit code on this file components/com_eventbooking/themes/default/common/events_timeline.php to change the behavior

Tuan

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

  • Javier Llamazares
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #134439 by Javier Llamazares
Replied by Javier Llamazares on topic Option to show or hide register button for each menu item
Thank you Tuan, it worked.
I know this is very specific, and the code is probably quite hacky, but here's what I did, in case anybody else finds it useful:

In file:
Code:
components/com_eventbooking/view/upcomingevents/tmpl/timeline.xml

Add:
Code:
<field name="hide_register_button_tlv" type="list" default="0" label="Hide Register Button" description="Choose to show/hide register button for this menu item"> <option value="0">No</option> <option value="1">Yes</option> </field>


Make a copy of file:
Code:
components/com_eventbooking/themes/default/common/events_timeline.php

To directory:
Code:
templates/my_template_directory/html/com_eventbooking/common/

Around line 48 add:
Code:
$app = JFactory::getApplication(); $menuitem = $app->getMenu()->getActive(); $params = $menuitem->params; if($params->get('hide_register_button_tlv')) { $hideRegisterButtons = true; }

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

More
3 years 11 months ago #134453 by Tuan Pham Ngoc
Yes, that works. Thanks for sharing the code

Just please note that when you update the extension to new version, the change to the xml file will be lost, so you should make a backup of that file and restore it after updating

Tuan
The following user(s) said Thank You: Javier Llamazares

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