Tribe__Customizer::register_section( string $id, array $args )

Use a “alias” method to register sections to allow users to filter args and the ID


Parameters #

$id

(string) (Required) The Unique section ID

$args

(array) (Required) Arguments to register the section


Top ↑

Return #

(WP_Customize_Section)


Top ↑

Source #

File: src/Tribe/Customizer.php

	public function register_section( $id, $args ) {
		/**
		 * Filter the Section ID
		 *
		 * @deprecated
		 * @since 4.0
		 *
		 * @param string            $section_id
		 * @param Tribe__Customizer $customizer
		 */
		$section_id = apply_filters( 'tribe_events_pro_customizer_section_id', $id, $this );

		/**
		 * Filter the Section ID
		 *
		 * @since 4.4
		 *
		 * @param string            $section_id
		 * @param Tribe__Customizer $customizer
		 */
		$section_id = apply_filters( 'tribe_customizer_section_id', $section_id, $this );

		// Tries to fetch the section
		$section = $this->manager->get_section( $section_id );

		// If the Panel already exists we leave returning it's instance
		if ( ! empty( $section ) ) {
			return $section;
		}

		/**
		 * Filter the Section arguments, so that developers can filter arguments based on $section_id
		 *
		 * @deprecated
		 * @since 4.0
		 *
		 * @param array             $args
		 * @param string            $section_id
		 * @param Tribe__Customizer $customizer
		 */
		$section_args = apply_filters( 'tribe_events_pro_customizer_section_args', $args, $section_id, $this );

		/**
		 * Filter the Section arguments, so that developers can filter arguments based on $section_id
		 *
		 * @since 4.4
		 *
		 * @param array             $args
		 * @param string            $section_id
		 * @param Tribe__Customizer $customizer
		 */
		$section_args = apply_filters( 'tribe_customizer_section_args', $args, $section_id, $this );

		// Don't allow sections outside of our panel
		$section_args['panel'] = $this->panel->id;

		// Actually Register the Section
		$this->manager->add_section( $section_id, $section_args );

		// Return the Section instance
		return $this->manager->get_section( $section_id );
	}

Top ↑

Changelog #

Changelog
Version Description
4.0 Introduced.