WPSEO_Metabox::get_additional_tabs()protectedYoast 1.0

Returns the metabox tabs that have been added by other plugins.

Метод класса: WPSEO_Metabox{}

Хуки из метода

Возвращает

WPSEO_Metabox_Section_Additional[].

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_additional_tabs();

Код WPSEO_Metabox::get_additional_tabs() Yoast 23.5

protected function get_additional_tabs() {
	$tabs = [];

	/**
	 * Private filter: 'yoast_free_additional_metabox_sections'.
	 *
	 * Meant for internal use only. Allows adding additional tabs to the Yoast SEO metabox.
	 *
	 * @since 11.9
	 *
	 * @param array[] $tabs {
	 *     An array of arrays with tab specifications.
	 *
	 *     @type array $tab {
	 *          A tab specification.
	 *
	 *          @type string $name         The name of the tab. Used in the HTML IDs, href and aria properties.
	 *          @type string $link_content The content of the tab link.
	 *          @type string $content      The content of the tab.
	 *          @type array $options {
	 *              Optional. Extra options.
	 *
	 *              @type string $link_class      Optional. The class for the tab link.
	 *              @type string $link_aria_label Optional. The aria label of the tab link.
	 *          }
	 *     }
	 * }
	 */
	$requested_tabs = apply_filters( 'yoast_free_additional_metabox_sections', [] );

	foreach ( $requested_tabs as $tab ) {
		if ( is_array( $tab ) && array_key_exists( 'name', $tab ) && array_key_exists( 'link_content', $tab ) && array_key_exists( 'content', $tab ) ) {
			$options = array_key_exists( 'options', $tab ) ? $tab['options'] : [];
			$tabs[]  = new WPSEO_Metabox_Section_Additional(
				$tab['name'],
				$tab['link_content'],
				$tab['content'],
				$options
			);
		}
	}

	return $tabs;
}