mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
👔 Simplify settings page header for new UI
This commit is contained in:
parent
0c16bfeb93
commit
48d87100de
2 changed files with 37 additions and 14 deletions
|
@ -94,11 +94,12 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
||||||
|
|
||||||
add_action(
|
add_action(
|
||||||
'woocommerce_paypal_payments_gateway_admin_options_wrapper',
|
'woocommerce_paypal_payments_gateway_admin_options_wrapper',
|
||||||
static function () : void {
|
function () : void {
|
||||||
global $hide_save_button;
|
global $hide_save_button;
|
||||||
$hide_save_button = true;
|
$hide_save_button = true;
|
||||||
|
|
||||||
echo '<div id="ppcp-settings-container"></div>';
|
$this->render_header();
|
||||||
|
$this->render_content();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -112,4 +113,24 @@ class SettingsModule implements ServiceModule, ExecutableModule {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Outputs the settings page header (title and back-link).
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function render_header() : void {
|
||||||
|
echo '<h2>' . esc_html__( 'PayPal', 'woocommerce-paypal-payments' );
|
||||||
|
wc_back_link( __( 'Return to payments', 'woocommerce-paypal-payments' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ) );
|
||||||
|
echo '</h2>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the container for the React app.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function render_content() : void {
|
||||||
|
echo '<div id="ppcp-settings-container"></div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,20 +94,22 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
||||||
$this->register_wc_tasks( $c );
|
$this->register_wc_tasks( $c );
|
||||||
$this->register_void_button( $c );
|
$this->register_void_button( $c );
|
||||||
|
|
||||||
add_action(
|
if ( ! $c->get( 'wcgateway.settings.admin-settings-enabled' ) ) {
|
||||||
'woocommerce_sections_checkout',
|
add_action(
|
||||||
function() use ( $c ) {
|
'woocommerce_sections_checkout',
|
||||||
$header_renderer = $c->get( 'wcgateway.settings.header-renderer' );
|
function () use ( $c ) {
|
||||||
assert( $header_renderer instanceof HeaderRenderer );
|
$header_renderer = $c->get( 'wcgateway.settings.header-renderer' );
|
||||||
|
assert( $header_renderer instanceof HeaderRenderer );
|
||||||
|
|
||||||
$section_renderer = $c->get( 'wcgateway.settings.sections-renderer' );
|
$section_renderer = $c->get( 'wcgateway.settings.sections-renderer' );
|
||||||
assert( $section_renderer instanceof SectionsRenderer );
|
assert( $section_renderer instanceof SectionsRenderer );
|
||||||
|
|
||||||
// phpcs:ignore WordPress.Security.EscapeOutput
|
// phpcs:ignore WordPress.Security.EscapeOutput
|
||||||
echo $header_renderer->render() . $section_renderer->render();
|
echo $header_renderer->render() . $section_renderer->render();
|
||||||
},
|
},
|
||||||
20
|
20
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
add_action(
|
add_action(
|
||||||
'woocommerce_paypal_payments_order_captured',
|
'woocommerce_paypal_payments_order_captured',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue