Hook to insert content above login form?

Ludovic

Member
I would like to "inject" text or even a logo above "Sign in to start your session", is there a hook for that and how to proceed please?
PNG image 2.png
Thank you for your help
 

twisted1919

Administrator
Staff member
There's the 'before_active_form' action hook, which is triggered before almost all forms, so in theory you can do:
PHP:
<?php

Yii::app()->hooks->addAction('before_active_form', function($collection) {
    // if not customer login, stop
    if (!Yii::app()->apps->isAppName('customer')) {
        return;
    }
    
    // if not /customer/index.php/guest/index, stop
    if ($collection->controller->route != 'guest/index') {
        return;
    }
    
    // print your html
    echo "Some html will appear here...";
});
Not tested :D
 

Ludovic

Member
Not too bad with formatting :p
HTML:
<table style="width: 100%; background-color: #525d7d; margin-left: auto; margin-right: auto;" cellpadding="2"><tbody><tr><td style="width: 100%; text-align: center; vertical-align: middle;" scope="row"><h1><strong><span style="color: #ffffff;">KingCourriel™</span></strong></h1></td></tr></tbody></table>
PNG image 3.png
Thanks a lot!
 
Top