Hi James,
What might make more sense here (rather than target Event Aggregator specifically) is an approach that provides default attributes when necessary for featured event images generally.
The tribe_event_featured_image hook provides an opportunity to do this:
add_filter( 'tribe_event_featured_image', function( $html, $event_id ) {
$img_start = strpos( $html, '<img ' );
$img_end = strpos( $html, '/>', $img_start );
$img_len = $img_end + 2 - $img_start;
if ( ! $img_start || ! $img_end ) {
return $html;
}
$img = substr( $html, $img_start, $img_len );
// Add an alt tag if it does not already have one
if ( false !== strpos( $img, 'alt="' ) ) {
$title = esc_attr( get_the_title( $event_id ) );
$img = substr_replace( $img, 'alt="' . $title . '" ', 5, 0 );
$html = substr_replace( $html, $img, $img_start, $img_len );
}
return $html;
}, 10, 2 );
The above shows one way of doing this that doesn’t assume any additional PHP extensions are installed and adds an alt tag if it is missing.
Adding captions or title attributes (for native ‘tooltips’) could be implemented using a similar approach. Does this help – or at least give you a starting point – with the first part of your question?