I’m trying to add a few wrappers around certain elements on the registration.
Our theme sets a few widths on the form elements to make it more presentable. I’ve scoured the codebase for filters and hooks to make this easier without having to override templates.
I’ve managed to successfully wrap sections around question groups using FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions and FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions I can’t seem to locate anything similar to allow me to wrap anything around the questions themselves.
We use BEM to add modifiers to form elements to alter the width within a flexbox. It doesn’t seem that EE4 offers much in the way of customising questions this way.
We also use input placeholders as the label for our forms, but again, there doesn’t seem to be any options for this.
FHEE__EE_Form_Input_Base___construct__input_args allows you to filter the $input_args passed to the constructor. You can pass other_html_attributes with a string value within the array to set the placeholder through the constructor.
What you have above also works but note that set_html_other_attributes() has been deprecated in favour of set_other_html_attributes(). That code would also set the placeholder on every input.
You should also be able to set the classes used for the input using the above filter, setting classes within the html_class field, separate the classes using space and make sure the default class is last in the list.
My bad, I was meant to type set_other_html_attributes (note how the function is called theme_set_other_html_attributes to note what it’s using.
You should also be able to set the classes used for the input using the above filter, setting classes within the html_class field, separate the classes using space and make sure the default class is last in the list.
This is only for the input element though isn’t it?
What I’m after is the element that wraps the label and input elements, which usually ends up looking something like #ee_reg_qstn-111-12-input-dv. Ideally i’d like to control these classes here. adding our own additional ones.
If I was to change html_class<code>tofield
for example. The above is what I end up with.
the input changes to ee-required field field--halfwidth ee-needs-value
the wrapper div changes to field-input-dv field--halfwidth-input-dv ee-text-input-dv
That does give me a little more control, but ideally I’d want to just control the wrapper div, and only prepend classes to what’s already there (without it appending -input-dv to it) and leave the input classes alone.
I appreciate that this is just how things work, and I’ll find a workaround for it. But it’d be nice to have singular control of only adding additional css classes and perhaps allowing these to be added on the question model itself so these kind of filters aren’t necessary.
Alas, you have led me to water again. I shall drink!
Viewing 5 reply threads
The support post ‘Additional Registration Form HTML’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.