Yoast_Form::admin_header()publicYoast 2.0

Generates the header for admin pages.

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

Хуков нет.

Возвращает

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

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

$Yoast_Form = new Yoast_Form();
$Yoast_Form->admin_header( $form, $option, $contains_files, $option_long_name );
$form(true|false)
Whether or not the form start tag should be included.
По умолчанию: true
$option(строка)
The short name of the option to use for the current page.
По умолчанию: 'wpseo'
$contains_files(true|false)
Whether the form should allow for file uploads.
По умолчанию: false
$option_long_name(true|false)
Group name of the option.
По умолчанию: false

Список изменений

С версии 2.0 Введена.

Код Yoast_Form::admin_header() Yoast 22.4

<?php
public function admin_header( $form = true, $option = 'wpseo', $contains_files = false, $option_long_name = false ) {
	if ( ! $option_long_name ) {
		$option_long_name = WPSEO_Options::get_group_name( $option );
	}
	?>
	<div class="wrap yoast wpseo-admin-page <?php echo esc_attr( 'page-' . $option ); ?>">
	<?php
	/**
	 * Display the updated/error messages.
	 * Only needed as our settings page is not under options, otherwise it will automatically be included.
	 *
	 * @see settings_errors()
	 */
	require_once ABSPATH . 'wp-admin/options-head.php';
	?>
	<h1 id="wpseo-title"><?php echo esc_html( get_admin_page_title() ); ?></h1>
	<div id="yst-settings-header-root"></div>
	<div class="wpseo_content_wrapper">
	<div class="wpseo_content_cell" id="wpseo_content_top">
	<?php
	if ( $form === true ) {
		$enctype = ( $contains_files ) ? ' enctype="multipart/form-data"' : '';

		$network_admin = new Yoast_Network_Admin();
		if ( $network_admin->meets_requirements() ) {
			$action_url       = network_admin_url( 'settings.php' );
			$hidden_fields_cb = [ $network_admin, 'settings_fields' ];
		}
		else {
			$action_url       = admin_url( 'options.php' );
			$hidden_fields_cb = 'settings_fields';
		}

		echo '<form action="'
			. esc_url( $action_url )
			. '" method="post" id="wpseo-conf"'
			. $enctype . ' accept-charset="' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- nothing to escape.
			. esc_attr( get_bloginfo( 'charset' ) )
			. '" novalidate="novalidate">';
		call_user_func( $hidden_fields_cb, $option_long_name );
	}
	$this->set_option( $option );
}