tribe_community_events_field_classes( string $field, string $classes = array(), boolean $echo = true )

Community events field classes.


Parameters #

$field

(string) (Required) The field name.

$classes

(string) (Optional) The field classes.

Default value: array()

$echo

(boolean) (Optional) (Optional) if true we print, else we return.

Default value: true


Top ↑

Return #

(mixed)


Top ↑

Source #

File: src/functions/template-tags.php

function tribe_community_events_field_classes( $field, $classes = [], $echo = true ) {

	// If we're receiving the classes as string, make it array.
	if ( ! is_array( $classes ) ) {
		$classes = explode( '', $classes );
	}

	// If the field is required, add the `required` class.
	if (
		tribe_community_is_field_required( $field )
		|| tribe_community_is_field_group_required( $field )
	) {
		$classes[] = 'required';
	}

	// Sanitize the $classes.
	$classes = array_map( 'sanitize_html_class', $classes );

	/**
	 * Filter the field classes.
	 * `tribe_community_events_field_label`
	 *
	 * @since 4.7.1
	 *
	 * @param string $field   The field name.
	 * @param string $classes The field classes.
	 */
	$classes = apply_filters( 'tribe_community_events_field_classes', $classes, $field );

	$classes = esc_attr( implode( ' ', $classes ) );

	if ( ! empty( $echo ) ) {
		echo $classes;
	} else {
		return $classes;
	}
}

Top ↑

Changelog #

Changelog
Version Description
4.7.1 Introduced.