It should look like:function MyExtension_RemoveOnloadFnc(&$SignInForm){
if ($SignInForm->IsPostBack) {
$SignInForm->Context->BodyAttributes = '';
/**
* or
* $SignInForm->Context->BodyAttributes = str_replace(
* " onload=\"Focus('txtUsername');\"",
* '',
* $SignInForm->Context->BodyAttributes);
*/
}
}
$Context->AddToDelegate('SignInForm',
'Constructor',
'MyExtension_RemoveOnloadFnc');
But you will have to had $this->CallDelegate('Constructor'); line 85 of /library/People/People.Control.SignInForm.php so that it look like : function SignInForm(&$Context, $FormName) {
...
}
$this->Context->BodyAttributes = " onload=\"Focus('txtUsername');\"";
}
$this->CallDelegate('Constructor');
}
The delegation will be added to the core. You have to to change /library/People/People.Control.SignInForm.php after the next release.
Comments
using the 'PreNoPostBackRender' delagation of the SignInForm Control:
<?php /* Extension Name: MyExtension Extension Url: n/a Description: Remove Sign-in body attributes. Version: 0.1.0 Author: Me Author Url: n/a */ function MyExtension_RemoveOnloadFnc(&$SignInForm){ $SignInForm->Context->BodyAttributes = ''; /** * or * $SignInForm->Context->BodyAttributes = str_replace( * " onload=\"Focus('txtUsername');\"", * '', * $SignInForm->Context->BodyAttributes); */ } $Context->AddToDelegate('SignInForm', 'PreNoPostBackRender', 'MyExtension_RemoveOnloadFnc');
Put that in /extensions/MyExtension/default.php and enable the extension on the extension setting page.
function MyExtension_RemoveOnloadFnc(&$SignInForm){ if ($SignInForm->IsPostBack) { $SignInForm->Context->BodyAttributes = ''; /** * or * $SignInForm->Context->BodyAttributes = str_replace( * " onload=\"Focus('txtUsername');\"", * '', * $SignInForm->Context->BodyAttributes); */ } } $Context->AddToDelegate('SignInForm', 'Constructor', 'MyExtension_RemoveOnloadFnc');
But you will have to had $this->CallDelegate('Constructor'); line 85 of /library/People/People.Control.SignInForm.php so that it look like :
function SignInForm(&$Context, $FormName) { ... } $this->Context->BodyAttributes = " onload=\"Focus('txtUsername');\""; } $this->CallDelegate('Constructor'); }
The delegation will be added to the core. You have to to change /library/People/People.Control.SignInForm.php after the next release.