WPSEO_Admin_Editor_Specific_Replace_Vars::add_for_page_types()protectedYoast 1.0

Adds the replavement variables for the given page types.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->add_for_page_types( $page_types, $replacement_variables_to_add );
$page_types(массив) (обязательный)
Page types to add variables for.
$replacement_variables_to_add(массив) (обязательный)
The variables to add.

Код WPSEO_Admin_Editor_Specific_Replace_Vars::add_for_page_types() Yoast 22.4

protected function add_for_page_types( array $page_types, array $replacement_variables_to_add ) {
	if ( empty( $replacement_variables_to_add ) ) {
		return;
	}

	$replacement_variables_to_add = array_fill_keys( $page_types, $replacement_variables_to_add );
	$replacement_variables        = $this->replacement_variables;

	$this->replacement_variables = array_merge_recursive( $replacement_variables, $replacement_variables_to_add );
}