public static function apply_component_is_event_visible(event_interface $event) {
        $mapper = self::$eventmapper;
        $eventvisible = null;
        if ($event->get_course_module()) {
            $requestinguserid = self::get_requesting_user();
            $legacyevent = $mapper->from_event_to_legacy_event($event);
            // We know for a fact that the the requesting user might be different from the logged in user,
            // but the event mapper is not aware of that.
            if (empty($event->user) && !empty($legacyevent->userid)) {
                $legacyevent->userid = $requestinguserid;
            }

            // TODO MDL-58866 Only activity modules currently support this callback.
            $eventvisible = component_callback(
                'mod_' . $event->get_course_module()->get('modname'),
                'core_calendar_is_event_visible',
                [
                    $legacyevent,
                    $requestinguserid
                ]
            );
        }

        // Do not display the event if there is nothing to action.
        if ($event instanceof action_event_interface && $event->get_action()->get_item_count() === 0) {
            return false;
        }

        // Module does not implement the callback, event should be visible.
        if (is_null($eventvisible)) {
            return true;
        }

        return $eventvisible ? true : false;
    }
public static function apply_component_is_event_visible(event_interface $event) {
        $mapper = self::$eventmapper;
        $eventvisible = null;
        if ($event->get_course_module()) {
            $requestinguserid = self::get_requesting_user();
            $legacyevent = $mapper->from_event_to_legacy_event($event);
            // We know for a fact that the the requesting user might be different from the logged in user,
            // but the event mapper is not aware of that.
            if (empty($event->user) && !empty($legacyevent->userid)) {
                $legacyevent->userid = $requestinguserid;
            }

            // TODO MDL-58866 Only activity modules currently support this callback.
            $eventvisible = component_callback(
                'mod_' . $event->get_course_module()->get('modname'),
                'core_calendar_is_event_visible',
                [
                    $legacyevent,
                    $requestinguserid
                ]
            );
        }

        // Do not display the event if there is nothing to action.
        if ($event instanceof action_event_interface && $event->get_action()->get_item_count() === 0) {
            return false;
        }

        // Module does not implement the callback, event should be visible.
        if (is_null($eventvisible)) {
            return true;
        }

        return $eventvisible ? true : false;
    }
public static function apply_component_is_event_visible ( event_interface $ event ) { $ mapper = self :: $ eventmapper ; $ eventvisible = null ; if ( $ event -> get_course_module ( ) ) { $ requestinguserid = self :: get_requesting_user ( ) ; $ legacyevent = $ mapper -> from_event_to_legacy_event ( $ event ) ; // We know for a fact that the the requesting user might be different from the logged in user, // but the event mapper is not aware of that. if ( empty ( $ event -> user ) && ! empty ( $ legacyevent -> userid ) ) { $ legacyevent -> userid = $ requestinguserid ; } // TODO MDL-58866 Only activity modules currently support this callback. $ eventvisible = component_callback ( 'mod_' . $ event -> get_course_module ( ) -> get ( 'modname' ) , 'core_calendar_is_event_visible' , [ $ legacyevent , $ requestinguserid ] ) ; } // Do not display the event if there is nothing to action. if ( $ event instanceof action_event_interface && $ event -> get_action ( ) -> get_item_count ( ) === 0 ) { return false ; } // Module does not implement the callback, event should be visible. if ( is_null ( $ eventvisible ) ) { return true ; } return $ eventvisible ? true : false ; }
Calls callback 'core_calendar_is_event_visible' from the component responsible for the event

The visibility callback is optional, if not present it is assumed as visible.
If it is an actionable event but the get_item_count() returns 0 the visibility
is set to false.

@param event_interface $event
@return bool
Calls callback core_calendar_is_event_visible from the component responsible for the event