WC_Admin_Attributes::output │ public static │ WC 1.0

Handles output of the attributes page in admin.

Shows the created attributes and lets you add new ones or edit existing ones. The added attributes are stored in the database and can be used for layered navigation.

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

Хуков нет.

Возвращает

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

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

$result = WC_Admin_Attributes::output();

Код WC_Admin_Attributes::output() WC 11.3.0

public static function output() {
	$result = '';
	$action = '';

	// Action to perform: add, edit, delete or none.
	if ( ! empty( $_POST['add_new_attribute'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Action helpers verify nonces; fields are normalized before CRUD.
		$action = 'add';
	} elseif ( ! empty( $_POST['save_attribute'] ) && ! empty( $_GET['edit'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Action helpers verify nonces; fields are normalized before CRUD.
		$action = 'edit';
	} elseif ( ! empty( $_GET['delete'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Action helpers verify nonces; fields are normalized before CRUD.
		$action = 'delete';
	}

	switch ( $action ) {
		case 'add':
			$result = self::process_add_attribute();
			break;
		case 'edit':
			$result = self::process_edit_attribute();
			break;
		case 'delete':
			$result = self::process_delete_attribute();
			break;
	}

	if ( is_wp_error( $result ) ) {
		echo '<div id="woocommerce_errors" class="error"><p>' . wp_kses_post( $result->get_error_message() ) . '</p></div>';
	}

	// Show admin interface.
	if ( ! empty( $_GET['edit'] ) ) {
		self::edit_attribute();
	} else {
		self::add_attribute();
	}
}