Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I would find it very useful to have the ability to choose more than one "if this field is empty" fields.
e.g. If this field, and this field and this field is empty then display a new field
Sorry can't help with the development as I cannot code with php but then again this is why I'm using this module!!
Its been very helpful to me thanks!
I hope I'm not repeating this issue:
http://drupal.org/node/1697148
Comments
Comment #1
rlnorthcuttThat sounds like it would be far more work to put into the module (and risk breaking other stuff), than it would be to just fix on your site. My suggestion is this:
1) Add in all of the views fields you want to check, and make them hidden (exclude from display)
2) Add an empty views field as a placeholder for the final display you want
3) Create a template file to override the view (check the theming information link on your view)
Then, you can simply put some simple php logic in your template file to check for which fields are empty or not. This could be a few if statements, or even a switch/case statement. The specifics will depend upon your use case.
I realize that you may not consider yourself a coder, but as scary as this may sound, its really pretty straightforward... and you will get your solution much faster than waiting to see if/when the module maintainer can get to a more complex solution.
If you post on the general forum (or IRC), then you can get specific help as you need it and as determined by your specific case.
If all else fails, you can post a bounty on the forum which can get you a quick solution too. This should be pretty cheap as its pretty simple, and you may want to spend a few bucks instead of learning how to do it yourself.
Comment #2
P2790 CreditAttribution: P2790 commentedHi,
Thanks for the detailed reply, appreciate it. I was always tempted to dabble in php and thanks to you I think I will. When looking at php from a learners perspective it looks like a mammoth task but I do much prefer learning on a case by case basis so maybe this is a good case to try it out
Comment #3
seanrYou can actually do this by daisy-chaining multiple ifempty fields together. I did this in a POC for a client yesterday and it worked just fine. :-) I suggest adding a bit of documentation to the project page and the readme describing this. The second ifempty field uses the first one for it's first value and your extra fallback field for its second one. Presumably you could do that as many times as you needed, but I don't know how performant it'd be (and it's a bit slow to set up).
Comment #4
benclark CreditAttribution: benclark commentedComment #5
benclark CreditAttribution: benclark commentedI have reworked the project page to add a Frequently Asked Questions section, and I've included this question at the end. @seanr, thanks for your assist with this!