Tribe__Template::do_entry_point( string $entry_point_name, boolean $echo = true )

Runs the entry point hooks and filters.


Parameters

$entry_point_name

(string) (Required) The name of the entry point.

$echo

(boolean) (Optional) If we should also print the entry point content.

Default value: true


Top ↑

Return

(null|string) null if an entry point is disabled or the entry point HTML.


Top ↑

Source

File: src/Tribe/Template.php

	public function do_entry_point( $entry_point_name, $echo = true ) {
		$hook_name = $this->get_template_current_hook_name();

		/**
		 * Filter if the entry points are enabled.
		 *
		 * @since 4.12.1
		 *
		 * @param boolean $is_enabled       Is entry_point enabled.
		 * @param string  $hook_name        For which template include this entry point belongs.
		 * @param string  $entry_point_name Which entry point specifically we are triggering.
		 * @param self    $template         Current instance of the template class doing this entry point.
		 */
		$is_entry_point_enabled = apply_filters( 'tribe_template_entry_point_is_enabled', true, $hook_name, $entry_point_name, $this );

		if ( ! $is_entry_point_enabled ) {
			return null;
		}

		ob_start();

		if ( has_action( "tribe_template_entry_point:{$hook_name}" ) ) {
			/**
			 * Generic entry point action for the current template.
			 *
			 * @since 4.12.1
			 *
			 * @param string $hook_name        For which template include this entry point belongs.
			 * @param string $entry_point_name Which entry point specifically we are triggering.
			 * @param self   $template         Current instance of the template class doing this entry point.
			 */
			do_action( "tribe_template_entry_point:{$hook_name}", $hook_name, $entry_point_name, $this );
		}

		if ( has_action( "tribe_template_entry_point:{$hook_name}:{$entry_point_name}" ) ) {
			/**
			 * Specific named entry point action called.
			 *
			 * @since 4.12.1
			 *
			 * @param string $hook_name        For which template include this entry point belongs.
			 * @param string $entry_point_name Which entry point specifically we are triggering.
			 * @param self   $template         Current instance of the template class doing this entry point.
			 */
			do_action( "tribe_template_entry_point:{$hook_name}:{$entry_point_name}", $hook_name, $entry_point_name, $this );
		}

		$html = ob_get_clean();

		if ( has_filter( "tribe_template_entry_point_html:{$hook_name}" ) ) {
			/**
			 * Generic entry point action for the current template.
			 *
			 * @since 4.12.1
			 *
			 * @param string $html             HTML returned and/or echoed for this for this entry point.
			 * @param string $hook_name        For which template include this entry point belongs.
			 * @param string $entry_point_name Which entry point specifically we are triggering.
			 * @param self   $template         Current instance of the template class doing this entry point.
			 */
			$html = apply_filters( "tribe_template_entry_point_html:{$hook_name}", $html, $hook_name, $entry_point_name, $this );
		}

		if ( has_filter( "tribe_template_entry_point_html:{$hook_name}:{$entry_point_name}" ) ) {
			/**
			 * Specific named entry point action called.
			 *
			 * @since 4.12.1
			 *
			 * @param string $html             HTML returned and/or echoed for this for this entry point.
			 * @param string $hook_name        For which template include this entry point belongs.
			 * @param string $entry_point_name Which entry point specifically we are triggering.
			 * @param self   $template         Current instance of the template class doing this entry point.
			 */
			$html = apply_filters( "tribe_template_entry_point_html:{$hook_name}:{$entry_point_name}", $html, $hook_name, $entry_point_name, $this );
		}

		if ( $echo ) {
			echo $html;
		}

		return $html;
	}