onCalendarDetailsFormat

The onCalendarDetailsFormat handler is called on an array of $vars containing all of the variables about to be substituted into a calendar event details view (in your theme, that’s the component lw_cal_event_details.html).

Using this handler you can overwrite existing variables, or create your own as in the example below.

<?php
     $_LW->REGISTERED_APPS['my_app']=[
       'title'=>'My App',
       'handlers'=>['onCalendarDetailsFormat'],
    ];

    class LiveWhaleApplicationMyApp {

      public function onCalendarDetailsFormat($vars) { 
        global $_LW;

        if (!empty($vars['tags_calendar'])) { 
          
          // if event has tags, add a {related_events} variable that shows events 
          // which share any of those tags (excluding the current event)
          
          $vars['related_events']=$_LW->widgetEval('<widget type="events">
            <arg id="tag">'.implode('</arg><arg id="tag">', $vars['tags_calendar']).'</arg>
            <arg id="tag_mode">any</arg>
            <arg id="filter" name="id" action="not_equals">' . $vars['id'] . '</arg>
            </widget>');
        };

        return $vars;
      }

   }
?>

The above example would be paired with the following change to the calendar component lw_cal_event_details.html. The if statement here is important, since obj.related_events might not always have a value.

{[ if (obj.related_events) { ]}
  <div id="lw_cal_event_related_events">
    <h3>Related Events:</h3>
    {{ related_events }}
  </div>
{[ } ]}