migrate_from_media_tab(); LoginPageModule::register_tab( aiou()->settings() ); $this->register_settings( aiou()->settings() ); ( new Feature() )->register(); } /** * Register the "Login Logo" section. * * @param SettingsRegistry $settings The settings registry. * @return void */ private function register_settings( SettingsRegistry $settings ): void { $settings->add_section( 'login', 'login_logo', __( 'Login Logo', 'all-in-one-utilities' ), __( 'Replace the default WordPress logo, link, and title text on the login screen (wp-login.php) with your own branding.', 'all-in-one-utilities' ), 10 ); $settings->add_field( 'login', 'login_logo', new Field( id: 'enabled', label: __( 'Custom login logo', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Replace the login page logo, its link, and its title text', 'all-in-one-utilities' ) ), priority: 10 ) ); $settings->add_field( 'login', 'login_logo', new Field( id: 'image_id', label: __( 'Logo image', 'all-in-one-utilities' ), type: 'media', default: 0, args: array( 'depends_on' => 'enabled' ), doc: new Doc( title: __( 'Logo image', 'all-in-one-utilities' ), short: __( 'Keep it under 320px wide, or part of it may get clipped by the login form.', 'all-in-one-utilities' ), detailed: __( 'Nothing changes on the login screen until an image is selected here, even with this section turned on.', 'all-in-one-utilities' ) ), priority: 20 ) ); $settings->add_field( 'login', 'login_logo', new Field( id: 'height', label: __( 'Logo height (px)', 'all-in-one-utilities' ), type: 'number', default: 84, args: array( 'depends_on' => 'enabled', 'min' => 1, 'max' => 500, 'step' => 1, ), doc: new Doc( title: __( 'Logo height', 'all-in-one-utilities' ), short: __( "WordPress's own login logo is 84px square -- that's the default here too. Raise it if your logo is wider or taller than that, so it isn't cropped.", 'all-in-one-utilities' ) ), priority: 30 ) ); $settings->add_field( 'login', 'login_logo', new Field( id: 'link_url', label: __( 'Logo link', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Link the logo to this site, instead of WordPress.org', 'all-in-one-utilities' ), 'depends_on' => 'enabled', ), priority: 40 ) ); $settings->add_field( 'login', 'login_logo', new Field( id: 'link_title', label: __( 'Logo title text', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Use this site\'s name as the logo\'s title text, instead of "Powered by WordPress"', 'all-in-one-utilities' ), 'depends_on' => 'enabled', ), priority: 50 ) ); } /** * One-time move of saved values from Settings → Media (where this * section used to live) to Settings → Login Page. * * @return void */ private function migrate_from_media_tab(): void { $media = get_option( 'aiou_settings_media' ); if ( ! is_array( $media ) || ! isset( $media['login_logo'] ) ) { return; } $login = get_option( 'aiou_settings_login', array() ); $login = is_array( $login ) ? $login : array(); if ( ! isset( $login['login_logo'] ) ) { $login['login_logo'] = $media['login_logo']; update_option( 'aiou_settings_login', $login ); } unset( $media['login_logo'] ); update_option( 'aiou_settings_media', $media ); } }