Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alex_b’s picture

Assigned: alex_b » Unassigned
Status: Active » Needs review
FileSize
2.3 KB

This is a first shot.

If it has a potential to be committed to Views, I can expand on it and add relationship handlers and argument validators that heed the vocabulary[module] field either to this patch or in follow up patches.

Background: I am using the vocabulary[module] field to make vocabularies exportable: #789556: Support taxonomy vocabularies

dawehner’s picture

Status: Needs review » Needs work
+++ modules/taxonomy.views.inc	4 May 2010 17:58:31 -0000
@@ -67,6 +67,20 @@ function taxonomy_views_data() {
+      'handler' => 'views_handler_field',
+      'name field' => 'name',

I think this is a c&p error.
I'm interested :) What happens if you add a field handler for a argument, does it crash totally, or are there any weird behaviors?

Powered by Dreditor.

Personally, i don't see a reason, why not to commit it to views. The field is in the database, so supporting it is totally fine.

alex_b’s picture

Status: Needs work » Needs review
FileSize
8.03 KB

dereine: yeah, I actually don't want to know ;-)

The attached patch:

- fixes the argument handler
- adds vocabulary[module] support to views_handler_filter_term_node_tid . UI: http://skitch.com/alexbarth/dnfy3/zend-studio

The module support for the filter handler comes with the caveat that it needs to fall back to the first vocabulary found if a module owns more than one vocabulary. This is a negotiable drawback for the use case that I am looking at: making vocabularies exportable (#789556) and I hope it's an acceptable approach for Views. If not, please advise.

mrfelton’s picture

nothing to add - just subscribing.

randallknutson’s picture

Tried this out in conjunction with http://drupal.org/node/789556 and was able to filter by a specific taxonomy and export that view to another machine.

randallknutson’s picture

I've added the ability to limit the list of terms in a field by vocabulary module.

yhahn’s picture

I've rerolled the patch in #6 using cvs -Nup, suitable for makefiles, etc.

mstef’s picture

Any chance of this seeing views 2.x?

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Sure the thing it's easy.
If someone reviews the patch and someone commits the patch it will get in.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Needs work
+    foreach ($vocabularies as $voc) {
+      $this->value_options[$voc->module] = $voc->module;
+    }

We may as well go for the 'user friendly' name of the module. It's available out of the system table and I believe system table is already loaded and cached, so it's just a matter of getting to it.

dawehner’s picture

Here is a rerole against the lastest version of 3.x

Sadly there is no api function to get the info out of the database.
So it's needed to write one, or?

merlinofchaos’s picture

Either that or just join the system table and extract it as a field.

dixon_’s picture

Interesting! Subscribing. Will test the patch later today and make a reroll against Views 3.x if needed.

dagmar’s picture

@merlinofchaos: Sadly readable name for modules is serialized into {system}.info, as far I know, there is not a easy way to extract it with SQL functions.

This may be a way to get the module names.

$res = db_query("SELECT name, info FROM system WHERE status <> 0 AND type = 'module'");
$modules = array();
while ($module = db_fetch_object($res)) {
  $info = unserialize($module->info);
  $modules[$module->name] = check_plain($info['name']);
}
dmitrig01’s picture

earl - given the initial use case of this patch, i think it woludn't be necessary (he's using it for made-up module names, to export it).

bforchhammer’s picture

Subscribing.. :)

Danny Englander’s picture

Subscribing

bojanz’s picture

Bump. I'd like to see this too (in both 3.x and 2.x, since I'm helping out on a project which uses 2.x).

I'm prepared to push this forward, just not sure in what direction (earl didn't reply to dmitrig01's #15)

bojanz’s picture

Assigned: Unassigned » merlinofchaos
smls’s picture

subscribe

merlinofchaos’s picture

Status: Needs work » Needs review

Hm. Probably should've been taken out of needs work based on disagreement with my review.

jghyde’s picture

FileSize
9.53 KB

I needed this to work with views 6--212, so I re-rolled #7 against that distro. This may help some of you old army guys like me who are seeking this feature in D6 Views 2. See attached.

kehan’s picture

Possibly related to this issue but not completely, you can specify a filter by vocabulary machine name name in drupal 7 / features #1071308: Features views filter on vocabulary uses vid

langworthy’s picture

The patch in #22 didn't work for me with views-6.x-2.12. The "Taxonomy: Vocabulary module" filter for the owner of the module has a broken/missing handler. The patch in #5 works but doesn't add options to the term filter as described in #3. The patch in #3 failed.

Patch in #11 fails (no surprise) in the latest 6.x-3.x-dev. I took a look but I'm not sure how to reroll it.

As mentioned in #15 I don't think we need to get the user friendly name of the module as mentioned in #10.

dawehner’s picture

This patch will probably not commited against views 2.x-dev so it's no big problem that it does not work with 6.x-2.12

langworthy’s picture

Of course. I was just trying to point out for others looking for a quick 2.12 fix that the patch supplied in #22 doesn't work for me.

christianchristensen’s picture

Re-rolled this patch against 6.x-3.x-dev from #11 ... worked on the failing hunks which seemed to be mainly from moving changes in 3.x branch.

katbailey’s picture

The previous 2 patches left out the views_handler_filter_vocabulary_module.inc file. The attached two patches are basically #27 with the missing file added, one version rolled with the --no-prefix option and one without...

makara’s picture

Re-rolled for latest Views 2.x.

MustangGB’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)