Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
views.module
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Dec 2012 at 19:51 UTC
Updated:
29 Jul 2014 at 21:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dawehnerThis patch works fine so far, though we need real tests.
Comment #2
dawehnerThis time with a patch. I couldn't get it working to use entity_view and compare the rendered output, so I choosed to just check the label.
Comment #3
dawehnerSo there are tests now.
Comment #4
damiankloip commentedI think view mode should be first, but that's just me :)
Do we want all the token form available here.
I think we should prefix this label with 'Rendered entity: ...' or something? People could easily get confused about the fact that every entity has on of these OR .. (Which I think is preferable) is to just have one generic rendered entity handler. So have an additional entity select field.
Either way we could change this to something like, 'Render an entity....blah'
Comment #5
dawehnerI really don't care that here :)
We talked about it, and it's doesn't hurt.
I totally agreed, fixed it.
Comment #6
dawehner#5: drupal-1857376-5.patch queued for re-testing.
Comment #7
tim.plunkettThis says node.module, in system.views.inc
Also, catch seemed rather reluctant to add views integration in system module
Comment #8
damiankloip commentedYeah, this might have to move into views instead.
Comment #10
dawehnerLet's move it! Fixed also some minor points like some @see, empty lines and different test groups.
Comment #11
damiankloip commentedGetting this issue going again (I know it's only been 5 days :)).
The previous patch was not filtering out the view entity type, as it was looking for 'views' and not 'view'. So I added some more test coverage for the data side of things.
I also changed the check to just check for all config entities, as we don't really want any of them. See interdiff.
Comment #12
dawehnerThank for starting the issue again :)
So if block instances will be config entities we don't want to allow people to render them here? This really sounds wrong. In general, why should we restrict to something which actually could work.
Comment #13
tim.plunkettHow about looking for things that provide a render controller class? Blocks will have that. And views can too #1857422: Add a ViewBuilder for Views, those can be used in an area handler currently.
Comment #14
damiankloip commentedYeah, that sounds sane. Do defaults get assigned for this?
Comment #15
tim.plunkettOh damn, it has a default of EntityRenderController, so EVERYTHING will have one. I'll open an issue to remove that default, all entity types shouldn't be renderable.
Comment #16
tim.plunkettSee #1882240: Remove default assignment of render_controller_class in EntityManager
Comment #17
damiankloip commentedYeah, I thought we might have a problem with this. That issue makes sense.
Comment #18
dawehnerJust to be sure, I think excluding views itself still makes sense, because the views area handler will always be special/provide a better use-case specific UI.
Comment #19
dawehnerHopefully once these entity tests got converted it would be easier to have a proper unit test here.
I removed the config storage controller check and replaced with a 'render_controller_class' check.
Comment #20
dawehnerI wonder how that happened :)
Comment #21
damiankloip commentedLooking good overall, just a couple of things:
I guess just having the entity ID is what we have to do, as an entity doesn't have to have a path, but maybe people expect a path? Just food for thought
This should use entity_get_view_modes now.
Nice, we get ALL THE TOKENS.
ughhh. I want entity_get_info back.... :)
Would having a variable for $data of something make that verboseness better?
Is there any way we can assert something to do with the view mode too? Might be tricky with entity_test.
We should add views as the module here, as we are probably removing the default in ViewPluginManager. This could wait but I guess we might as well add it while the patch is being worked on? If not, we can just add it when we do that change.
Comment #22
dawehnerYeah it's not the best UX so far. Once this patch is in we could iterate on top of it, and reuse the entity_reference autocompletion callbacks (optionally) to use it here.
The great here is that this allows us to drop loading the entity info.
Good idea!
Well ... we could put some logik into the render controller, like print out the name of the viewmode. Do you think we should do it in this issue?
Comment #23
damiankloip commentedIf it's a smallish change (adding the view mode), which I think it should be? Then I say go for it in here, then it's out of the way and tested. Once it is rendered, the assertion is pretty quick to add I guess.
Good idea using the entity reference autocomplete! That will make a nice follow up issue.
I wont change the status yet in case you want to roll a new patch with the view mode? Otherwise, test away.
Comment #24
dawehnerThis needed way too long, so stepping back from the computer after that patch.
Comment #26
dawehner#24: drupal-1857376-24.patch queued for re-testing.
Comment #27
damiankloip commentedAwesome, This is great now. Sorry if those tests took a while :/ They are good though! I think that makes much better coverage.
This is a good idea, for easy overriding if needed.
Comment #28
xjmSince this is an entity system integration (and required to convert the taxonomy term view) I think this is more of a task.
Comment #29
catchI don't really get allowing an explicit ID here, for taxonomy terms it's going to need to take the term from arguments and the test is hard-coding this to a test entity with ID = 1?
Comment #30
catchFor taxonomy/term, while I don't really like them, I'd normally except the taxonomy term at the top to be an attachment.
Comment #31
dawehnerEhm right, I planned to put that in later, but we can for sure do that now as well.
Extended the test coverage for that as well.
Comment #32
catchI'd still like to know what we get from this compared to using an attachment display (except for not having to instantiate two displays). Or wait if one display is listing nodes and the other taxonomy terms is that why?
Comment #33
dawehnerSo right, an attachment can be only created on the same view, which means in practice that you can only have the same entity types listed there.
In theory you could embed a view in the area (that's already possible), though this would require a lot more steps then simply embedding a single entity in there. Additional at the moment you can't do that for blocks (just an example) as we don't have a EQ query backend, but this will probably change in the future.
If you don't think that's useful for core, I will create a contrib project for it and put it in there.
Comment #34
olli commentedHere should be some processing for options before returned and used in view mode select.
Do we have an issue for this @todo somewhere?
Comment #35
dawehnerCan you explain what you meant with that?
Here is a follow-up: #1934420: Allow area handlers to return a render array
Comment #36
olli commentedSorry, see EntityRow::buildViewModeOptions() or add rendered entity to header and select view mode.
Comment #37
dawehnerOh yeah, you are absolute right!
Comment #38
olli commentedComment #40
dawehnerJust fixing the test.
Comment #41
damiankloip commentedThis is looking great now!
Comment #42
dawehner#40: drupal-1857376-40.patch queued for re-testing.
Comment #44
tstoecklerThe testbot could really be nicer and give some better error messages. :-)
Comment #45
tstoecklerOn the other hand it would help if I run the tests myself. Humans 1 - 1 Machines.
Thanks @dawehner for pointing this out.
Comment #46
ParisLiakos commentedthis is blocking #1857256: Convert the taxonomy listing and feed at /taxonomy/term/%term to Views, also changes is legit. back to rtbc, it is going to take the bot a while to catch up but it ll let us know if it disagrees
Comment #47
dawehnerThis would be so great to have it in!
So I'm wondering whether we display 'entity' to the site builder now? Not sure about the recommended way at the moment.
Comment #48
webchickReviews are mixed on that point. I know Bojhan's not a fan, I'm equally not a fan of hiding things under the covers, especially when a word actually means what it is (unlike "node").
However, since strings are something we can change anytime before RC1, I think it's ok to let this go in and have a follow-up discussion about that.
Committed and pushed to 8.x. Thanks!
Comment #50
sunA hidden gem in the footer area entity_id.
Should the tests have passed? Depends on whether entity_test entity IDs are integers, and whether 0 is a valid entity ID.
Comment #51
xjmCan we please, please, please open followups rather than resurrecting closed issues? Until we can make some changes to improve the issue queue UX, reopened, multi-commit, sprawling issues present a barrier to contribution. They create confusion when blaming for the commit log, muddy the issue scope, make the subsequent changes more difficult to review, and make it more difficult to assign self-contained cleanups or bug fixes to novices.
Comment #52
xjmFiled #1957050: Bugged tests in the entity error handler?.
Comment #53
dawehner@sun
The entity area handler allows you to replace tokens by arguments from the url/passed into the view. So !1 stands for the first argument of the view.
So we check here that the token got replaced with the actual right ID and then the full entity is loaded.
From my perspective this doesn't seem to be an issue, feel free to reopen if you think I'm wrong.