Hooks::filter_view_html_classes( TribeEventsFilterbarViewsV2_1array $html_classes, string $view_slug, TribeEventsViewsV2View $instance )

Filters the HTML classes applied to a View top-level container.


Parameters

$html_classes

(<span class="TribeEventsFilterbarViewsV2_1array">TribeEventsFilterbarViewsV2_1array) (Required) Array of classes used for this view.

$view_slug

(string) (Required) The current view slug.

$instance

(TribeEventsViewsV2View) (Required) The current View object.


Top ↑

Source

File: src/Tribe/Views/V2_1/Hooks.php

	public function filter_view_html_classes( array $html_classes, $view_slug, View $instance ) {
		/**
		 * Allows views to toggle off FBAR classes on the container.
		 *
		 * @since 5.0.2
		 *
		 * @param boolean $add_html_classes Whether to add classes or not. Defaults to true.
		 * @param string  $view_slug        The current view slug.
		 * @param View    $instance         The current View object.
		 *
		 * @return boolean $add_html_classes Whether to add classes or not.
		 */
		$add_html_classes = apply_filters(
			'tribe_events_views_v2_filter_bar_view_html_classes',
			true,
			$view_slug,
			$instance
		);

		/**
		 * Allows views to tell FBAR to not add its classes to their container.
		 *
		 * @since 5.0.2
		 *
		 * @param boolean $add_html_classes Whether to add classes or not.
		 * @param string  $view_slug        The current view slug.
		 * @param View    $instance         The current View object.
		 *
		 * @return boolean $add_html_classes Whether to add classes or not.
		 */
		$add_html_classes = apply_filters(
			"tribe_events_views_v2_filter_bar_{$view_slug}_view_html_classes",
			$add_html_classes,
			$view_slug,
			$instance
		);

		if ( ! tribe_is_truthy( $add_html_classes ) ) {
			return $html_classes;
		}

		return $this->container->make( Filters\Factory::class )->for_html_classes( $html_classes, $view_slug, $instance );
	}

Top ↑

Changelog

Changelog
Version Description
5.0.2 Add filter to turn off adding classes to some containers.
5.0.0 Introduced.