EOF;
}
}
return $registerHtml;
}
function register(Doku_Event_Handler $controller)
{
/**
* To modify the register form and add class
*
* Deprecated object passed by the event but still in use
* https://www.dokuwiki.org/devel:event:html_registerform_output
*/
$controller->register_hook('HTML_REGISTERFORM_OUTPUT', 'BEFORE', $this, 'handle_register_page', array());
/**
* Event using the new object but not yet used
* https://www.dokuwiki.org/devel:event:form_register_output
*/
// $controller->register_hook('FORM_REGISTER_OUTPUT', 'BEFORE', $this, 'handle_register', array());
}
function handle_register_page(&$event, $param)
{
/**
* The register page is created via buffer
* We print before the forms
* to avoid a FOUC
*/
print Identity::getHtmlStyleTag(self::TAG);
/**
* @var Doku_Form $form
*/
$form = &$event->data;
$class = &$form->params["class"];
Identity::addIdentityClass($class, self::FORM_REGISTER_CLASS);
$newFormContent = [];
/**
* Header (Logo / Title)
*/
$newFormContent[] = Identity::getHeaderHTML($form, self::FORM_REGISTER_CLASS);
/**
* Form Attributes
* https://getbootstrap.com/docs/5.0/forms/layout/#horizontal-form
*/
$rowClass = "row";
if (Bootstrap::getBootStrapMajorVersion() == Bootstrap::BootStrapFourMajorVersion) {
$rowClass .= " form-group";
}
$firstColWeight = 5;
$secondColWeight = 12 - $firstColWeight;
/**
* Replace the field
*
* The password text localized by lang is shared
* between the password and the password check field
*/
$passwordText = "Password";
foreach ($form->_content as $pos => $field) {
if (!is_array($field)) {
continue;
}
$fieldName = $field["name"];
if ($fieldName == null) {
// this is not an input field
if ($field["type"] == "submit") {
/**
* This is important to keep the submit element intact
* for forms integration such as captcha
* The search the submit button to insert before it
*/
$classes = "btn btn-primary";
if (isset($field["class"])) {
$field["class"] = $field["class"] . " " . $classes;
} else {
$field["class"] = $classes;
}
$field["tabindex"] = "6";
$newFormContent[] = $field;
}
continue;
}
switch ($fieldName) {
case "login":
$loginText = $field["_text"];
$loginValue = $field["value"];
$loginHTML = <<