Posted by damiankloip on October 10, 2012 at 2:30pm
4 followers
| Project: | Views |
| Version: | 8.x-3.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | VDC |
Issue Summary
A use case for this is in #1808542: Allow area handlers to override the page title when used in an empty area.. Overriding the title only really makes sense to use as an empty area handler.
Think of how views_fetch_fields would fetch handlers for a base_table etc...
We could add this 'type' to the plugin definition or the views_data. If no type/types are specified, then any area handler should be assumed E.g. Text.
Questions
Where should we put the logic to filter this? Plugin manager level? after we have got the list of definitions or data?
Comments
#1
What about something like this?
#2
Yes something like this is kind of what I was thinking. I think this is the right stage to filter available handlers. How about we make it work for arrays too? I also changed the docs slightly. Hope that's ok.
Also, we don't have any tests for views_fetch_fields I don't think? It would be a good idea, as it's quite important.
#3
@dawehner had a better idea of casting the value to an array and just checking that.
#4
Let's write a proper test coverage for this function #1809608: Write test coverage for views_fetch_fields
#5
tim suggested switching the $sub_type parameter to be last, let's do that.
#6
+++ b/views_ui/admin.incundefined@@ -1746,7 +1746,7 @@ function views_ui_config_item_form($form, &$form_state) {
+ $base_fields = views_fetch_fields($view->storage->base_table, $form_state['type'], $form_state['type'], $view->display_handler->useGroupBy());
Then let's switch it :)
#7
Ahaha
#8
Here is a test based on #1809608: Write test coverage for views_fetch_fields
#9
.
#10
The last submitted patch, views-1808670-8.patch, failed testing.
#11
Well sure, the other patch didn't got in yet.
#12
#9: views-1808670-8.patch queued for re-testing.
#13
The last submitted patch, views-1808670-8.patch, failed testing.
#14
Just a rerole.
#15
Rerolled with a better assertion message.
#16
+++ b/lib/Drupal/views/Tests/ViewsDataTest.phpundefined@@ -110,6 +126,16 @@ class ViewsDataTest extends ViewTestBase {
+ $expected_keys = array_walk($expected['header'], function(&$item) {
+ $item = "views_test_data.$item";
Should this be checking against the expected footer? $expected[$sub_type] instead?
#17
You are totally right here, let's see whether this test run works fine as well.
#18
That's better :)
#19
Great, committed and pushed
#20
Automatically closed -- issue fixed for 2 weeks with no activity.