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.
This module has been working great for me. I recently discovered a conflict with another module that also converts multiselect fields. (The multiselect module -- http://drupal.org/project/multiselect ). I looked at the code of both of these modules, and because they work pretty differently, I couldn't see an obvious way to make them play well together.
So that leads me to a much more general question: Is there a way to exclude a field from being converted to Better Select checkboxes? Anyone done this already?
Comment | File | Size | Author |
---|---|---|---|
#8 | 540918.patch | 2.62 KB | alex.k |
Comments
Comment #1
batchman_paradize CreditAttribution: batchman_paradize commentedHere is a quick and dirty way to add this functionality to betterselect.module. I won't provide a patch at the moment since I have lots of other new code in my current betterselect.module right now. It might get submitted later though, if someone really wants it.
Note: All the code below is supposed to be put in betterselect.module.
Add this to function betterselect_admin_settings:
Add this to the end of the arguments of the first if-statement in function betterselect_process:
Add this function somewhere at the end:
Comment #2
lelizondo CreditAttribution: lelizondo commentedI've tried the code and I don't know if is not working or if I just have the wrong expression, I'm using:
Since I don't want to use betterselect on any field on that node add page.
Any help would be appreciated
Comment #3
batchman_paradize CreditAttribution: batchman_paradize commentedThe code works if you put it in the right place, but your regular expression is wrong, it should be:
All "/" except the start and end ones has to be escaped using "\" since I use the whole string, including the start and end "/" directly as an argument. If you want to know more about regular expressions in PHP you can visit this page:
http://www.regular-expressions.info/php.html
What do you think about this type of filter? Maybe it would've been a good idea to add some easy way to check the validity of a filter? Anyone knows about a good set of regular expressions to validate regular expressions in PHP?
Comment #4
lelizondo CreditAttribution: lelizondo commentedThanks, I'll try it later. About your question, I think is not the easiest way to filter what fields should be excluded. Check-boxes would be easier but that means the route would be excluded and there could be cases when you want to exclude a field on a certain route and include it on some other route
Comment #5
batchman_paradize CreditAttribution: batchman_paradize commentedOk, looking forward to your report whether it works or not.
I know it's not a very easy filter to use for everyone, but it's definitely the most flexible one. What I was looking for was to maybe use at least some type of validation which makes sure the strings are correct. Also maybe some type of test where you can enter a path and test against. Someone who feels up to the task? I don't have the time at the moment.
Comment #6
lelizondo CreditAttribution: lelizondo commentedI don't know enought about preg_match to help you with a validation, what I can do is to provide better help inline and provide a patch will I'll be doing it tonight.
Comment #7
scalp CreditAttribution: scalp commentedI'd love to be able to use this. I've got all the code in the right place (I think), but no matter what I put in the exclude list I cannot get it to exclude. I really just need to have this module affect the output of one field on the user/%/edit page, but hiding it on the node creation forms would probably do the trick.
EDIT: Disregard. I got this working per the directions above. I had another module installed that was causing the problem. Works great. Thanks!
Comment #8
alex.k CreditAttribution: alex.k commentedThe change works for me and here it is attached as a patch against current CVS.
Comment #9
danielbeeke2 CreditAttribution: danielbeeke2 commentedHey
I like the module,
and I needed this patch
wouldn't it be beter to select where the betterselect gets loaded with the 'common' drupal way
pages to exclude
or
pages to include
for now I added a checkbox to the settings view with 'show only on view pages'
cause thats where i needed it
than i added a check if were on a view.
Greetings Daniel