Support

Home Forums Event Espresso Premium Venue name in Calendar 3.1 EE4

Venue name in Calendar 3.1 EE4

Posted: November 2, 2014 at 9:45 am

Viewing 2 reply threads


sdavea

November 2, 2014 at 9:45 am

Hi I’m trying to figure out how to add the venue name to the calendar. I understand it requires changes to the core files but I can’t quite figure it out (there’s a few references in this support form but it only seems to relate to EE3).

I’d like to add a line to the end of the $tooltip_html string; can I use espresso_venue_name() and what’s the global variable for the current venue?

Thanks in advance, Shaun


Tony

  • Support Staff

November 3, 2014 at 10:05 am

Hi sdavea,

There is no global variable that holds the current venue.

The venue is associated with the ‘event’ object, so you need to use that object to pull in the information.

This is not something we would normally provide under general support, but I looked into this to see how it would be done.

Within \ee4-calendar\EED_Espresso_Calendar.module.php on line 421 you’ll find this:

$event = $datetime->event();

Under there call the venues() method on the event object:

$venue = $event->venues();

This will return an array of venue objects, you only need the single object so then do

$venue = !empty( $venue ) ? array_shift( $venue ) : NULL;

You now have a venue object containing all of the venue information for your event.

Now go down to roughly line 505:

$tooltip_html = '
';

After the opening div for $tooltip_html add something like:

if ( $venue instanceof EE_Venue ) {
$tooltip_html .= '' . $venue->name() . '';
}

Like so – http://take.ms/igItY

Which will output the venue name within a span with a class of venue within the tooltip.

  • This reply was modified 10 years ago by Tony. Reason: Added check for EE_Venue


sdavea

November 4, 2014 at 4:01 am

That works perfectly, thank you!

Viewing 2 reply threads

The support post ‘Venue name in Calendar 3.1 EE4’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso