diff --git a/assets/sass/authorize-application/_googlesitekit-authorize-application.scss b/assets/sass/authorize-application/_googlesitekit-authorize-application.scss index 62d09e009af..0609d1e2a6a 100644 --- a/assets/sass/authorize-application/_googlesitekit-authorize-application.scss +++ b/assets/sass/authorize-application/_googlesitekit-authorize-application.scss @@ -97,6 +97,35 @@ padding: 4px 9px; } } + + .googlesitekit-authorize-application__footer { + display: none; + + @media (min-width: $bp-wpAdminBarTablet) { + bottom: 0; + display: block; + left: 0; + line-height: $lh-authorize-application-headline-sm; + margin-left: 36px; + padding: 0 47px; + position: absolute; + + p { + color: $c-authorize-application-sys-light-on-surface; + font-family: $f-primary; + font-size: $fs-authorize-application-footer-lg; + font-weight: $fw-medium; + } + } + + @media (min-width: $width-desktop + 1 + px) { + margin-left: 160px; + } + } +} + +#wpbody-content { + padding-bottom: 100px; } #wpcontent, @@ -105,11 +134,15 @@ font-family: $f-primary; padding: 0 10px; - @media (min-width: $width-wpAdminBarTablet + 1 + px) { + @media (min-width: $bp-wpAdminBarTablet) { padding: 0 47px; } } +#wpfooter { + bottom: 45px; +} + #approve, #reject { border-radius: $br-lg; diff --git a/assets/sass/config/_variables.scss b/assets/sass/config/_variables.scss index 1fd1e6cba0e..cc56b8d923b 100644 --- a/assets/sass/config/_variables.scss +++ b/assets/sass/config/_variables.scss @@ -343,6 +343,7 @@ $fs-authorize-application-title-lg: 18px; $fs-authorize-application-label-lg: 14px; $fs-authorize-application-label-md: 12px; $fs-authorize-application-body-md: 14px; +$fs-authorize-application-footer-lg: 16px; $lh-authorize-application-headline-sm: 32px; $lh-authorize-application-title-lg: 24px; diff --git a/includes/Core/Admin/Authorize_Application.php b/includes/Core/Admin/Authorize_Application.php index a31594ecb36..b43251d2700 100644 --- a/includes/Core/Admin/Authorize_Application.php +++ b/includes/Core/Admin/Authorize_Application.php @@ -64,6 +64,7 @@ public function __construct( */ public function register() { add_action( 'admin_enqueue_scripts', $this->get_method_proxy( 'enqueue_assets' ) ); + add_action( 'admin_footer', $this->get_method_proxy( 'render_custom_footer' ) ); } /** @@ -114,4 +115,15 @@ private function enqueue_assets() { $this->assets->enqueue_asset( 'googlesitekit-authorize-application-css' ); } } + + /** + * Renders custom footer for the Authorize Application screen if the service is a Google service. + * + * @since n.e.x.t + */ + private function render_custom_footer() { + if ( $this->is_authorize_application_screen() && $this->is_google_service() ) { + echo ''; + } + } } diff --git a/tests/phpunit/integration/Core/Admin/Authorize_ApplicationTest.php b/tests/phpunit/integration/Core/Admin/Authorize_ApplicationTest.php index d7c4a16ed12..97d7d46ba82 100644 --- a/tests/phpunit/integration/Core/Admin/Authorize_ApplicationTest.php +++ b/tests/phpunit/integration/Core/Admin/Authorize_ApplicationTest.php @@ -39,6 +39,13 @@ public function test_register() { // Check that the expected assets are enqueued. $this->assertTrue( wp_style_is( 'googlesitekit-authorize-application-css', 'enqueued' ) ); + + ob_start(); + do_action( 'admin_footer' ); + $output = ob_get_clean(); + + // Check that the custom footer content is rendered. + $this->assertStringContainsString( '', $output ); } public function test_register_with_incorrect_success_url() { @@ -61,6 +68,13 @@ public function test_register_with_incorrect_success_url() { // Check that the assets aren't enqueued due to incorrect success URL. $this->assertFalse( wp_style_is( 'googlesitekit-authorize-application-css', 'enqueued' ) ); + + ob_start(); + do_action( 'admin_footer' ); + $output = ob_get_clean(); + + // Check that the custom footer content isn't rendered. + $this->assertStringNotContainsString( '', $output ); } public function test_register_with_incorrect_screen() { @@ -83,6 +97,14 @@ public function test_register_with_incorrect_screen() { // Check that expected assets aren't enqueued due to incorrect screen. $this->assertFalse( wp_style_is( 'googlesitekit-authorize-application-css', 'enqueued' ) ); + + ob_start(); + do_action( 'admin_footer' ); + $output = ob_get_clean(); + + // Check that the custom footer content isn't rendered. + $this->assertStringNotContainsString( '', $output ); + } public function set_global_get_params( $success_url ) {