I came across a case where it was useful to have node terms not separated by commas or plus, but by spaces.
(It is for a case where the argument as a whole is forwarded by Views to an external service, with the help of YQL Views Query Backend, if anyone's interested.)
A patch that allows this is attached. It also appends some clarifications in the help text, "Space separation is used only for non-standard argument handling".
With three different concatenators it is pretty close to start thinking about a more generalized way of defining separators -- but I think these three are pretty special. Plus and comma are used internally by Views, and space must be among the top three separator characters. If Views should be able to send off arguments queries across the web, it seems sensible to include the space separator. (At least to me.)
Cheers!
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | special-operators-AND-OR-for-node-terms.patch | 5.11 KB | itangalo |
| space-separator-for-node-terms.patch | 1.08 KB | itangalo |
Comments
Comment #1
itangalo commentedPS: This issue is strongly related to all_terms_from_node: Pass all terms as argument to view, which is now marked for porting to D7.
Comment #2
itangalo commentedWhen digging a bit deeper I realized that my patch doesn't change anything at all --
ctools_break_phrase()changes it back to concatenation with plus.I don't have the skills to analyze ctools_break_phrase() fully, and most definately not to understand what consequences it could have to start messing with it, so I'm changing the status to 'active'.
Sorry that I didn't bring a working patch along with the feature request. :-/
I realized that my patch didn't work after giving common concatenators some thought. If the concatenation options are extended I suggest adding space,
ANDandORto the list, as those concatenators are quite common in searches/queries.Comment #3
itangalo commentedMaybe poor skills are ment to be trained.
Attached is a patch that introduces the special operators AND and OR along with the ordinary + and , operators.
I have basically done the following:
* Extended the select list of possible operators with
special: ANDandspecial: OR. (Note that both keywords are intentionally padded with spaces.)* Rewritten most of
ctools_break_phrase(), so it now checks for the new operators as well. In doing this I changed thepreg_matchstuff for explicitstrposchecks. It allowed me to understand what I was doing (and I think it may also be cheaper -- correct me if I'm wrong).* Modified
ctools_context_create_termsandctools_context_terms_convertso they now both check for special operators in alternative to applying the standard concatenations with + and ,.* Updated a few help and description texts.
It should now be possible to add more 'special' operators by the following to steps.
1. Extend the options array for the concatenator with the desired concatenator.
2. Apply a new operator check in
ctools_break_phrase, describing the operator asspecial:[your_operator_string].I didn't dare introduce spaces as a special operator, since I presume spaces are being used every once in a while instead of +. (It also turned out that I didn't need the spaces to start with...)
The introduced changes shouldn't affect anything that is *not* marked with
special:, so this patch should only affect the new operators. But I'm new on coding, so looking through the changes is probably a good idea.Comment #4
itangalo commentedI vote for closing this issue in favour of turning attention to extending the use of strings as contexts:
http://drupal.org/node/915824
See http://nodeone.se/blogg/nodeone-talks-drupal-views-3-yql-arguments-and-p... for details.
Comment #5
pfortuna commentedGreat video..!
Comment #6
pfortuna commentedI am unable to get the the Add Argument Filed Name to appear after running patch. In the video at 4:00 to 4:03.
When I click to Add Arguments the Field text at the bottom does not appear.
Using Clean Setup
Drupal 16.9
Ctools 6.x 1.7
Views 6.3.x dev
YQL Backend 1.x 1.0 Alpha 2
Loaded patch to ctools directory:
patched ctools.module, plugins/contexts/terms.inc plugins/relationship/terms_from_node.inc
Run patch -p0 < file.patch
Comment #7
itangalo commented@pfortuna: Arguments are only available in the dev version of YQL Views Query Backend, right now.
Glad you liked the video!
Comment #8
pfortuna commentedthanks. I'll try to test it this week. I really like the ideas presented. Thanks.
Comment #9
japerryClosing this issue as outdated as Drupal 6 ctools is not supported. If this issue is relevant for Drupal 7, feel free to re-open and mark for Drupal 7 (or 8)