Tribe__Settings_Tab::__construct( string $id, string $name, array $args = array() )

class constructor


Parameters

$id

(string) (Required) the tab's id (no spaces or special characters)

$name

(string) (Required) the tab's visible name

$args

(array) (Optional) additional arguments for the tab

Default value: array()


Top ↑

Source

File: src/Tribe/Settings_Tab.php

		public function __construct( $id, $name, $args = array() ) {

			// setup the defaults
			$this->defaults = array(
				'fields'           => array(),
				'priority'         => 50,
				'show_save'        => true,
				'display_callback' => false,
				'network_admin'    => false,
			);

			// parse args with defaults
			$this->args = wp_parse_args( $args, $this->defaults );

			// set each instance variable and filter
			$this->id   = apply_filters( 'tribe_settings_tab_id', $id );
			$this->name = apply_filters( 'tribe_settings_tab_name', $name );
			foreach ( $this->defaults as $key => $value ) {
				$this->{$key} = apply_filters( 'tribe_settings_tab_' . $key, $this->args[ $key ], $id );
			}

			// run actions & filters
			if ( ! $this->network_admin ) {
				add_filter( 'tribe_settings_all_tabs', array( $this, 'addAllTabs' ) );
			}
			add_filter( 'tribe_settings_tabs', array( $this, 'addTab' ), $this->priority );
		}