Posted by damiankloip on January 17, 2013 at 1:19pm
8 followers
| Project: | Drupal core |
| Version: | 8.x-dev |
| Component: | views.module |
| Category: | task |
| Priority: | normal |
| Assigned: | damiankloip |
| Status: | closed (fixed) |
| Issue tags: | VDC |
Issue Summary
In D7 we have an entity type filter handler that we can use for bundle filtering, Let's port that to D8. Then nodes/taxonomy etc... can just use this and we can remove any others.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| vdc.entity-type-filter.patch | 5.34 KB | Idle | FAILED: [[SimpleTest]]: [MySQL] 50,708 pass(es), 0 fail(s), and 113 exception(s). | View details |
Comments
#1
Probably needs tests too.
#2
There are just nitpicks:
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/EntityType.phpundefined@@ -0,0 +1,85 @@
+ * Definition of views_handler_filter_entity_bundle
ups :)
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/EntityType.phpundefined@@ -0,0 +1,85 @@
+ public $entityType;
...
+ public $entityInfo;
This should be better protected
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/EntityType.phpundefined@@ -0,0 +1,85 @@
+ // Set the entity type from the definition data, if it's there.
+ if (isset($this->definition['entity_type'])) {
+ $this->entityType = $this->definition['entity_type'];
+ }
Should we just ignore it, if it's not needed/used here?
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/EntityType.phpundefined@@ -0,0 +1,85 @@
+ $options[$type] = t($info['label']);
Isn't the label already runned through t()?
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/EntityType.phpundefined@@ -0,0 +1,85 @@
+ $this->ensureMyTable();
A comment might be helpful.
#3
The last submitted patch, vdc.entity-type-filter.patch, failed testing.
#4
Thanks for the review! Here are those changes, see interdiff.
#5
Sorry, complete fail on the protected properties, here we go.
#6
The last submitted patch, 1891214-4.patch, failed testing.
#7
#8
Ups
#9
Here are some tests too, I have also modified entity_test module to use a bundle too.
#10
The last submitted patch, d8.entity-type-filter-with-tests.patch, failed testing.
#11
Need to fix the other tests that rely on entity_test module.
#12
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.phpundefined@@ -64,6 +73,13 @@ class EntityTest extends EntityNG {
+ * The bundle type.
You might be able to improve that comment.
Additional isn't the type a scalar value, like "test_1" aka. a string?
+++ b/core/modules/views/lib/Drupal/views/Tests/Entity/FilterEntityTest.phpundefined@@ -0,0 +1,99 @@
+class FilterEntityTest extends ViewTestBase {
I'm wondering whether we could use unit tests for that.
+++ b/core/modules/views/lib/Drupal/views/Tests/Entity/FilterEntityTest.phpundefined@@ -0,0 +1,99 @@
+ * @todo.
He, at least that's honest :)
#13
I have re worked this to use node instead for now. Adding a bundle to entity_test module requires quite alot of work with alot of tests having to be changed.
Here is the handler with tests using node as the base table, and some custom bundles. I think this means we can't use unittests too, which is a shame.
What do you think?
#14
Let's get that in, we have tests.
We can always try to rework existing tests to use DrupalUnitTests
#15
Why are you calling the bundle filter entity type filter? You are not filtering on entity type (that wouldn't make any sense!)
#16
Sorry x-post but also , IMO this is CNW.
#17
Yep, fair comments. I have changed the filter class to Bundle, and also the test class to FilterEntityBundleTest.
#18
Noone knows yet what will happen if we have proper typed data support in views, but for now this looks really good!
#19
Fix title
#20
That's great.( I almost got a heart attack from the earlier title thinking Views invented some super base that can be filtered on entity type. Phew.)
#21
AHAHA :) Sorry about that...
#22
So that's what people always wanted to have: support for UNION.
#23
Looks great. I had to write one of these in Drupal 7 for a custom entity type and couldn't believe it didn't exist there. Committed/pushed to 8.x.
#24
Super.
#25
This was never retested after #1822458: Move dynamic parts (view modes, bundles) out of entity_info(), and broke HEAD.
git revert 44cedfa
#26
Rolled back.
#27
#28
Here is a patch that unbreaks it.
#29
ok, a new patch.
#30
oops
#31
The last submitted patch, 1891214-29.patch, failed testing.
#32
#29: 1891214-29.patch queued for re-testing.
#33
I guess we can move that back to RTBC?
#34
#29: 1891214-29.patch queued for re-testing.
#35
Let's try that again. Committed/pushed to 8.x.
#36
Automatically closed -- issue fixed for 2 weeks with no activity.