Topic on Project:Support desk

[Developer question] How to modify the css of buttons on Special:Login to show even longer texts on the button [solved, solution added]

5
Wikinaut (talkcontribs)

I use E:PluggableAuth and wish to deliberately modify the css of the buttons ("Login with password" and "Login with SSO of Server...").

The texts are too long for the buttons (mw1.41.0).

I cannot find in the source how to modify the button layout and kindly ask for your help how to change the layout (css and texts) of the registration/login page.

Osnard (talkcontribs)
Wikinaut (talkcontribs)

@Osnard:

thanks for your swfit reply.

Your reply exactly confirms my multiple observations before I filed my support request.

Especially I think that the development of such a custom extension as proposed by you might be required.

Perhaps anyone has a stub for such a type of custom extension which modifies the layout - or do you have a pointer to an suited extesnion to start with?

Osnard (talkcontribs)

Actually you may be able to add such small thing directly to the LocalSettings

Example:

$GLOBALS['wgHooks']['BeforePageDisplay'][] = function( OutputPage &$out, Skin &$skin ) {
	$style = "<style type=\"text/css\">\n";
	$style .= "YOUR CSS GOES HERE";
	$style .= "</style>\n";

	$out->addHeadItem( 'change-login-button', $style );

	return true;
};

This is not really recommended though, as this kind of hook registration may be removed in the future.

Also have a look at Extension:BoilerPlate.

Wikinaut (talkcontribs)

@Osnard This is the finally working version, fixed.

It makes the buttons (here the standard Login-button and the Extension:OpenIDConnect-Login-button) to display all texts on the buttons, even if the texts are longer:

# https://www.mediawiki.org/w/index.php?title=Topic:Xx8ol75kyh1qejp8
# How to modify the Login-Page
$GLOBALS['wgHooks']['BeforePageDisplay'][] = function( OutputPage &$out, Skin &$skin ) {
        $style = <<<EOT
            <style type="text/css">
                    button#wpLoginAttempt {
                            white-space: normal;
                            word-wrap: break-word;
                            height: auto !important;
                    }

                    button#mw-input-pluggableauthlogin0 {
                            background-color: salmon !important;
                            border-color: salmon !important;
                            white-space: normal;
                            word-wrap: break-word;
                            height: auto !important;
                    }
            </style>
EOT;

        $out->addHeadItem( 'change-login-button', $style );
        return true;
};
Reply to "[Developer question] How to modify the css of buttons on Special:Login to show even longer texts on the button [solved, solution added]"