View::get_messages( array $events = array() )
Returns a collection of user-facing messages the View will display on the front-end.
Contents
Parameters
- $events
-
(array) (Optional) An array of the events found by the View that is currently rendering.
Default value: array()
Return
(TribeEventsViewsV2Messages) A collection of user-facing messages the View will display on the front-end.
Source
File: src/Tribe/Views/V2/View.php
public function get_messages( array $events = [] ) {
$slug = $this->get_slug();
/**
* Fires before the view "renders" the array of user-facing messages.
*
* Differently from the filters below this action allow manipulating the messages handler before the messages
* render to, as an example, change rendering strategy and manipulate the message "ingredients".
*
* @since 4.9.11
*
* @param Messages $messages The object instance handling the messages for the View.
* @param array $events An array of the events found by the View that is currently rendering.
* @param View $this The View instance currently rendering.
*/
do_action( 'tribe_events_views_v2_view_messages_before_render', $this->messages, $events, $this );
$messages = $this->messages->to_array();
/**
* Filters the user-facing messages the View will print on the frontend.
*
* @since 4.9.11
*
* @param array $messages An array of messages in the shape `[ <message_type> => [ ...<messages> ] ]`.
* @param View $this The current View instance being rendered.
* @param Messages $messages_handler The messages handler object the View used to render the messages.
*/
$messages = apply_filters( 'tribe_events_views_v2_view_messages', $messages, $this, $this->messages );
/**
* Filters the user-facing messages a specific View will print on the frontend.
*
* @since 4.9.11
*
* @param array $messages An array of messages in the shape `[ <message_type> => [ ...<messages> ] ]`.
* @param array $events An array of the events found by the View that is currently rendering.
* @param View $this The current View instance being rendered.
* @param Messages $messages_handler The messages handler object the View used to render the messages.
*/
$messages = apply_filters( "tribe_events_views_v2_view_{$slug}_messages", $messages, $events, $this, $this->messages );
return $messages;
}
Changelog
| Version | Description |
|---|---|
| 4.9.11 | Introduced. |