Download & Extend

Provide a way for area handlers to be available by area type

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

Status:active» needs review

What about something like this?

AttachmentSizeStatusTest resultOperations
views-1808670-1.patch3.25 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,089 pass(es).View details

#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.

AttachmentSizeStatusTest resultOperations
1808670-2-array.patch3.95 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,074 pass(es).View details

#3

@dawehner had a better idea of casting the value to an array and just checking that.

AttachmentSizeStatusTest resultOperations
1808670-3.patch3.74 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,074 pass(es).View details

#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.

AttachmentSizeStatusTest resultOperations
1808670-5.patch2.93 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,074 pass(es).View details

#6

Status:needs review» needs work

+++ 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

Status:needs work» needs review

Ahaha

AttachmentSizeStatusTest resultOperations
1808670-7.patch2.23 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,074 pass(es).View details

#8

#9

.

AttachmentSizeStatusTest resultOperations
views-1808670-8.patch4.07 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch views-1808670-8.patch. Unable to apply patch. See the log in the details link for more information.View details

#10

Status:needs review» needs work

The last submitted patch, views-1808670-8.patch, failed testing.

#11

Well sure, the other patch didn't got in yet.

#12

Status:needs work» needs review

#9: views-1808670-8.patch queued for re-testing.

#13

Status:needs review» needs work

The last submitted patch, views-1808670-8.patch, failed testing.

#14

Status:needs work» needs review

Just a rerole.

AttachmentSizeStatusTest resultOperations
views-1808670-14.patch4.05 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,142 pass(es).View details

#15

Rerolled with a better assertion message.

AttachmentSizeStatusTest resultOperations
views-1808670-15.patch4.04 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,142 pass(es).View details

#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.

AttachmentSizeStatusTest resultOperations
views-1808670-17.patch4.04 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,142 pass(es).View details

#18

Status:needs review» reviewed & tested by the community

That's better :)

#19

Status:reviewed & tested by the community» fixed

Great, committed and pushed

#20

Status:fixed» closed (fixed)

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

nobody click here