1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-14 02:34:24 +02:00

Update ProcessForgotPassword to have a dedicated hookable renderForm() method for simpler hook modifications

This commit is contained in:
Ryan Cramer
2020-01-13 08:50:45 -05:00
parent b8dcdb7758
commit abc32780e3

View File

@@ -32,6 +32,7 @@
* @method string renderContinue($url = './', $label = '') Render a continue link
* @method string renderError($str) Render an error (when useInlineNotices is true)
* @method string renderMessage($str) Render a message (when useInlineNotices is true)
* @method string renderForm(InputfieldForm $form, $formName)
*
*
*/
@@ -204,8 +205,8 @@ class ProcessForgotPassword extends Process implements ConfigurableModule {
$form->add($submit);
$this->sessionSet('step', 1);
return $form->render();
return $this->renderForm($form, 'step1');
}
/**
@@ -467,7 +468,7 @@ class ProcessForgotPassword extends Process implements ConfigurableModule {
$out = $this->step4_completeReset($id, $form);
} else {
$this->sessionSet('step', 3);
$out = $form->render();
$out = $this->renderForm($form, 'step3');
}
} else {
@@ -988,6 +989,20 @@ class ProcessForgotPassword extends Process implements ConfigurableModule {
return "<p class='pwfp-message'>" . $this->wire('sanitizer')->entities1($str) . "</p>";
}
/**
* For hooks that want to modify form before it is rendered
*
* @param InputfieldForm $form
* @param string $formName
* @return string
* @since 3.0.149
*
*/
protected function ___renderForm(InputfieldForm $form, $formName) {
if(!$form->attr('name')) $form->attr('name', $formName);
return $form->render();
}
/**
* Install this module by creating it's table
*