Tribe__Events__Customizer__Global_Elements::register_settings( WP_Customize_Section $section, WP_Customize_Manager $manager )

Create the Fields/Settings for this sections


Parameters

$section

(WP_Customize_Section) (Required) The WordPress section instance

$manager

(WP_Customize_Manager) (Required) WP_Customize_Manager instance.


Top ↑

Return

(void)


Top ↑

Source

File: src/Tribe/Customizer/Global_Elements.php

	public function register_settings( WP_Customize_Section $section, WP_Customize_Manager $manager ) {
		$customizer = Tribe__Customizer::instance();

		$manager->add_setting(
			$customizer->get_setting_name( 'link_color', $section ),
			array(
				'default'              => $this->get_default( 'link_color' ),
				'type'                 => 'option',

				'sanitize_callback'    => 'sanitize_hex_color',
				'sanitize_js_callback' => 'maybe_hash_hex_color',
			)
		);

		$manager->add_control(
			new WP_Customize_Color_Control(
				$manager,
				$customizer->get_setting_name( 'link_color', $section ),
				array(
					'label'   => esc_html__( 'Link Color', 'the-events-calendar' ),
					'section' => $section->id,
				)
			)
		);

		$manager->add_setting(
			$customizer->get_setting_name( 'filterbar_color', $section ),
			array(
				'default'              => $this->get_default( 'filterbar_color' ),
				'type'                 => 'option',

				'sanitize_callback'    => 'sanitize_hex_color',
				'sanitize_js_callback' => 'maybe_hash_hex_color',
			)
		);

		$manager->add_control(
			new WP_Customize_Color_Control(
				$manager,
				$customizer->get_setting_name( 'filterbar_color', $section ),
				array(
					'label'   => esc_html__( 'Filter Bar Color', 'the-events-calendar' ),
					'section' => $section->id,
				)
			)
		);

		$manager->add_setting(
			$customizer->get_setting_name( 'button_color', $section ),
			array(
				'default'              => $this->get_default( 'button_color' ),
				'type'                 => 'option',

				'sanitize_callback'    => 'sanitize_hex_color',
				'sanitize_js_callback' => 'maybe_hash_hex_color',
			)
		);

		$manager->add_control(
			new WP_Customize_Color_Control(
				$manager,
				$customizer->get_setting_name( 'button_color', $section ),
				array(
					'label'   => esc_html__( 'Button Color', 'the-events-calendar' ),
					'section' => $section->id,
				)
			)
		);

		// Custom Map Pins are not supported with basic embeds.
		if ( ! tribe_is_using_basic_gmaps_api() ) {

			$manager->add_setting(
				$customizer->get_setting_name( 'map_pin', $section ),
				array(
					'default'              => $this->get_default( 'map_pin' ),
					'type'                 => 'option',
					'sanitize_callback'    => 'esc_url_raw',
				)
			);

			$manager->add_control(
				new WP_Customize_Image_Control(
					$manager,
					$customizer->get_setting_name( 'map_pin', $section ),
					array(
						'default'    => $this->get_default( 'button_color' ),
						'label'      => esc_html__( 'Map Pin', 'the-events-calendar' ),
						'section'    => $section->id,
					)
				)
			);
		}

		// Introduced to make Selective Refresh have less code duplication
		$customizer->add_setting_name( $customizer->get_setting_name( 'link_color', $section ) );
		$customizer->add_setting_name( $customizer->get_setting_name( 'filterbar_color', $section ) );
		$customizer->add_setting_name( $customizer->get_setting_name( 'button_color', $section ) );

		// To add Live Edit Pins will require some JS refactor to be able to work
		// $customizer->add_setting_name( $customizer->get_setting_name( 'map_pin', $section ) );

	}