This started as a data-retrieving-only function for use in #822554: Views display plugins not marked as dependencies (which is still needed), but I expanded it to mimic the "Fields used in views" report page as well, since I realized it's a really great way to check which Views you remembered to add access checks to, or caching, or where you used mini pagers.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Status: Active » Needs review
FileSize
3.53 KB

See attached.

dawehner’s picture

Status: Needs review » Needs work

oh i really like this feature!

+++ b/views.moduleundefined
@@ -238,6 +238,59 @@ function _views_find_module_templates($cache, $path) {
+      foreach (views_fetch_plugin_data() as $type => $info) {

I'm wonderding why there is no local variable for this function call.
This call is done for all views and displays

joachim’s picture

+++ b/views.module
@@ -238,6 +238,59 @@ function _views_find_module_templates($cache, $path) {
+      foreach (views_fetch_plugin_data() as $type => $info) {
+        if ($type == 'display' && isset($display->display_plugin)) {
+          $name = $display->display_plugin;
+        }
+        elseif (isset($display->display_options["{$type}_plugin"])) {
+          $name = $display->display_options["{$type}_plugin"];
+        }
+        elseif (isset($display->display_options[$type]['type'])) {
+          $name = $display->display_options[$type]['type'];

Will that get all the plugins types?

What about exposed forms, argument validators, and argument defaults (to name just a few)?

This is going to be a really cool feature -- but a complex one :)

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
173.38 KB
3.39 KB

It works for display, style, row, access, cache, exposed_form, pager, query, and localization plugin types. I have no idea if it works for display_extenders :)

Because argument validator and argument default plugins are configured per field, I didn't think it was reasonable to recurse that far.

Especially for the use case of features exports, generally they're provided by the same module that provides the field type being used, or they're custom and they're your problem anyway.

I moved views_fetch_plugin_data() outside the loop, even though its statically cached and Views loops over it in other places :)
Also switched to views_get_enabled_views() instead of checking manually.

Here's a screenshot of the page as well:
Screen Shot 2012-07-16 at 7.42.25 AM.png

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

Yep, this is a pretty awesome patch :) Just tested this out, works nicely. The only possible thing I would say is would it be better to have the plugin type first? As this is the alphabetical sort, it makes it easier on the eye to scan as the titles don't end up in order.

tim.plunkett’s picture

FileSize
3.39 KB

I agree.

damiankloip’s picture

RTBC again in that case ;)

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x-3.x and 8.x-3.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.