Yoast_Integration_Toggles::load_toggles()protectedYoast 1.0

Loads the available integration toggles.

Also ensures that the toggles are all Yoast_Feature_Toggle instances and sorted by their order value.

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

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

Возвращает

Массив. List of sorted Yoast_Feature_Toggle instances.

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

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

Код Yoast_Integration_Toggles::load_toggles() Yoast 24.0

protected function load_toggles() {
	$integration_toggles = [
		(object) [
			/* translators: %s: 'Semrush' */
			'name'            => sprintf( __( '%s integration', 'wordpress-seo' ), 'Semrush' ),
			'setting'         => 'semrush_integration_active',
			'label'           => sprintf(
				/* translators: %s: 'Semrush' */
				__( 'The %s integration offers suggestions and insights for keywords related to the entered focus keyphrase.', 'wordpress-seo' ),
				'Semrush'
			),
			'order'           => 10,
		],
		(object) [
			/* translators: %s: Algolia. */
			'name'               => sprintf( esc_html__( '%s integration', 'wordpress-seo' ), 'Algolia' ),
			'premium'            => true,
			'setting'            => 'algolia_integration_active',
			'label'              => __( 'Improve the quality of your site search! Automatically helps your users find your cornerstone and most important content in your internal search results. It also removes noindexed posts & pages from your site’s search results.', 'wordpress-seo' ),
			/* translators: %s: Algolia. */
			'read_more_label'    => sprintf( __( 'Find out more about our %s integration.', 'wordpress-seo' ), 'Algolia' ),
			'read_more_url'      => 'https://yoa.st/4eu',
			'premium_url'        => 'https://yoa.st/4ex',
			'premium_upsell_url' => 'https://yoa.st/get-algolia-integration',
			'order'              => 25,
		],
	];

	/**
	 * Filter to add integration toggles from add-ons.
	 *
	 * @param array $integration_toggles Array with integration toggle objects where each object
	 *                                   should have a `name`, `setting` and `label` property.
	 */
	$integration_toggles = apply_filters( 'wpseo_integration_toggles', $integration_toggles );

	$integration_toggles = array_map( [ $this, 'ensure_toggle' ], $integration_toggles );
	usort( $integration_toggles, [ $this, 'sort_toggles_callback' ] );

	return $integration_toggles;
}