Hi,
I found that a div having a class name "pre-instructions" is always printed in my forms, even if it's empty.
So, I dug into the form configurations and I saw the "Intro form instructions" textarea in the page to edit a form. It was empty. So, I continue to dug, but this time, into the module code to find the source of it and I found it in entityform.admin.inc at line 261 where the condition to show it or not is :
if (!empty($entityform_type->data['instruction_pre'])
The problem with this case is that $entityform_type->data['instruction_pre'] contains :
Array
(
[value] =>
[format] => filtered_html
)In fact, it's not empty, even if the real value is empty because the format value will always contain something.
So, the fix I suggest is this:
if (!empty($entityform_type->data['instruction_pre']) && !empty($entityform_type->data['instruction_pre']['value'])) {
Tell me what you think about it.
Thank you!
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | intro_form_inscructions-2457737-13.patch | 779 bytes | joelpittet |
| #8 | entityform-hide-instructions-if-empty-2457737-8.patch | 668 bytes | pakmanlh |
| #3 | entityform-hide-instructions-if-empty-2457737-3.patch | 668 bytes | moriartie |
Comments
Comment #1
franckylfs commentedComment #2
tedbowThanks for posting this. I see the issue you are talking and it looks like your fix would work.
Can you post patch? Here are instructions: https://www.drupal.org/node/707484
Thanks
Comment #3
moriartie commentedMade a patch with the change described in #1
Comment #4
kenorb commentedComment #6
pakmanlhThe #4 patch works properly. I rerolled it to apply.
Many thanks!
Comment #8
pakmanlhSorry, bad patch. This one apply against 7.x-2.x
Cheers
Comment #10
pakmanlhComment #12
rodrigoaguileraAfter using this patch for a while I can confirm that it works and seems correct.
Comment #13
joelpittetWe should be able to just put in if (!$entityform_type->get_prop('instruction_pre')). That way we know if the content is empty or not. The return value will be '' which evaluates to FALSE.
How about this patch?
Comment #14
das-peter commentedJust stumbled across this too. I think the approach from #13 is the most straight forward and efficient.
I'd say good to go.
Comment #15
joelpittetThanks @das-peter, I've committed and pushed to the dev branch