Tribe__Admin__Help_Page::add_section( string $id, string $title = null, integer $priority = 10, string $type = 'default' )

Adds a new section to the Help Page


Parameters

$id

(string) (Required) HTML like ID.

$title

(string) (Optional) The Title of the section, doesn't allow HTML.

Default value: null

$priority

(integer) (Optional) A Numeric ordering for the Section.

Default value: 10

$type

(string) (Optional) by default only 'default' or 'box'.

Default value: 'default'


Top ↑

Return

(object) The section added


Top ↑

Source

File: src/Tribe/Admin/Help_Page.php

	public function add_section( $id, $title = null, $priority = 10, $type = 'default' ) {
		if ( empty( $id ) ) {
			return false;
		}

		// Everytime you call this we will add this up
		self::$section_count++;

		$possible_types = (array) apply_filters( 'tribe_help_available_section_types', array( 'default', 'box' ) );

		// Set a Default type
		if ( empty( $type ) || ! in_array( $type, $possible_types ) ) {
			$type = 'default';
		}

		// Create the section and Sanitize the values to avoid having to do it later
		$section = (object) array(
			'id'       => sanitize_html_class( $id ),
			'title'    => esc_html( $title ),
			'priority' => absint( $priority ),
			'type'     => sanitize_html_class( $type ),

			// This Method Unique count integer used for ordering with priority
			'unique_call_order' => self::$section_count,

			// Counter for ordering Content
			'content_count' => 0,

			// Setup the Base for the content to come
			'content' => array(),
		);

		$this->sections[ $section->id ] = $section;

		return $section;
	}

Top ↑

Changelog

Changelog
Version Description
4.0 Introduced.