Search the Community
Showing results for tags 'hookbefore'.
-
I am building a form for an inscription, so I want to have a token in a link in the mail to the subscriber, on which they click, to validate their email. So I tried to create a hidden field and to feed it through addHookBefore. It did not work, so I tried to create the field and feed it still through addHookBefore I did not work, neither. Here is my function : $forms->addHookBefore('FormBuilderProcessor::renderReady', function($e){ $processor = $e->object; // FormBuilderProcessor instance $form = $e->arguments(0); if($processor->formName == 'inscription') { $field = $this->modules->get('InputfieldHidden'); $field->attr('id+name', 'verif-token'); $field->label = "Token de vérification"; $field->value = bin2hex(random_bytes(32)); $field->required = true; $form->add($field); } }); My field in the link inside the mail is empty or I have the fielname between brackets. Maybe I miss a detail or my strategy is wrong.
- 4 replies
-
- formbuider
- hidden input
-
(and 1 more)
Tagged with:
-
Hi, I have a method (___renderImage) which renders an image tag (<img src) and has a single argument: Pageimage $image. Now I have a hook called "beforeRenderImage" in which I'd like to add a property to the argument of ___renderImage. So for example, I'd like to add a property "requiredDimension" to the argument before ___renderImage is called. Is this possible?