Home › Forums › Quform WordPress › Can you detect Admin > Entries-mode v's Email notification mode?
- This topic has 5 replies, 2 voices, and was last updated 6 years, 9 months ago by
katw.
- AuthorPosts
- May 7, 2018 at 7:11 am #25526
katw
ParticipantI want to change the html code wrapped around the values submitted for the email field, file upload field and multi-select checkbox fields.
I have found the hook “quform_get_value_html_X_X” but as the description says this hook is used for both notifications and entry view.
I want them styled differently not the same.
Q1. Is there a way to apply changes using this hook to a specific context (ie entry-view v’s notification)?
Q1-B. Is there a switch or flag I can query to detect the mode and do custom formatting for each?
My idea:
add_filter('quform_get_value_html_1_5', function ($value, Quform_Element_Field $element, Quform_Form $form) { if ($isEntryView) { /* leave as formatted with mailto hyperlink */ } else { /* reformat no emailhyperlink */ return '<span style="color:blue;">' . $form->getValue('quform_1_5') . '</span>'; } }, 10, 3);
Q2. Does the custom code always have to return a value or will underlying code become the default if custom code returns nothing?
In my example above I don’t return anything for entry-view as I am happy with normal output given.
Q3. Using the getValue() function to access the raw field value, do I have to ‘escape’ the field contents like you did in getValueHTML before using it? (Quform::escape($fielddata))
- This topic was modified 7 years ago by
katw. Reason: Added question about escaping string contents when doing my own wrapper
May 9, 2018 at 12:14 am #25587Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 10, 2018 at 1:28 am #25605katw
ParticipantWhich environmental value would HTML Email notifications use?
May 10, 2018 at 1:40 am #25606katw
ParticipantA small request.
Could you in next release add class names to the html lists you auto generate for notifications for multi-select, checkbox and file elements.
I.E Change the getValueHtml() function to add a CLASS name. A different one for files, checkbox and multi-select elements as styling may need to be different.
Using advanced selectors in email html is not possible. The ideal solution is a custom setting where we can define the custom inline style we want attached to the UL and another for the LI elements.
You would then insert a style=”<our code>” to the UL, and the other style code to each LI
Give it thought.
May 11, 2018 at 3:48 pm #25651Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
July 25, 2018 at 2:58 am #26367katw
ParticipantThank you,
your help was awesome.
Close ticket
- This topic was modified 7 years ago by
- AuthorPosts
- You must be logged in to reply to this topic.