Closed (fixed)
Project:
Entity Print
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 May 2016 at 22:24 UTC
Updated:
1 Jul 2016 at 09:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jordanpagewhite commentedThis is a WIP patch of the changes that are needed to modularize the current 8.x-1.x branch in a way that adding additional Engines* is simple. I won't bother to write a lengthy explanation here because I know it isn't great yet. I'll upload another patch, possibly tomorrow, and write an appropriate explanation of the changes I am proposing to the architecture of the project.
Comment #3
benjy commentedThanks for getting started, would be good to have an issue summary that describes the approach when you're ready.
Couple of comments below.
I'm happy to simply called this EntityPrintBuilder or even PrintBuilder is nicer again?
Same here we should take the opportunity to clean-up some naming, how about printEntity or even just print()?
Comment #4
jordanpagewhite commentedI've updated the issue summary with the proposed changes to the file structure. I will have to check my patch and make sure that it actually matches the suggested file structure. I was working on this patch and the Word Export patch simultaneously, and I don't think that I was careful enough in my commits and rebasing to match my intention. I'll fix it and upload the corrected patch though.
Comment #5
jordanpagewhite commentedComment #6
benjy commentedDo you think we need different plugin types for every export_type, i was wondering if we could get away with a generic print plugin?
Comment #7
jordanpagewhite commentedHmm. I don't know. Let me give it a shot and see what happens.
Comment #8
jordanpagewhite commentedOkay, so I gave it another shot and tried to use a generic print plugin as you suggested. That is what I was hoping I could do with my first patch, but I think I misunderstood some of the components. After spending quite a bit more time reading through the existing code, I think I am headed in a better direction with this patch. This should be more sustainable and modular. That being said, there are some issues with this patch in its current state. The /entityprint/node/1/debug works, but anything that utilizes an export library does not work.
Currently, I have tried to change the config schema like so:
Also, the updated file structure is:
Comment #9
benjy commentedin your global ~/.gitconfig file can you put:
This should help Git recognise when files have only been renamed and reduce the size of the diff.
Also, you can ignore the schema errors for now if you like, add
protected $strictConfigSchema = FALSE;in the test files, and we can focus on getting everything else green.Comment #10
jordanpagewhite commentedGotcha. I made that change to my global gitignore. Thanks for the suggestion. They are easier to read now.
You can see the changes I made in this latest patch in the interdiff. The route-based export and Action plugin export are both working properly now. I think this provides a very extensible base to build upon with other export types. I will have to work on the tests though. I haven't updated them yet.
Comment #11
benjy commentedIs the controller defaulting to PDF? I'm wondering if we need a new URL structure as well? Maybe /export_type/entity_type/entity_id, thoughts?
Let me know when you're ready for a thorough review and i'll go over it properly, probably won't do that until I return on the 4th though.
Comment #12
jordanpagewhite commentedYeah, the controller is currently defaulting to PDF. I think we will need a new URL structure. I like /export_type/entity_type/entity_id. That is the same URL structure I was using in my patch to add Export to Word via PHPWord. That should be in this patch though. I will update the routing file, check all of the tests, and then I think it will be ready to review.
Thanks again for your help and feedback.
Comment #13
jordanpagewhite commentedWould it be simpler to change the URL structure to
/entityprint/{{ export_type }}/{{ entity_type }}/{{ entity_id }}
and the debug route could either be
/entityprint/debug/{{ entity_type }}/{{ entity_id }} OR
/entityprint/html/{{ entity_type }}/{{ entity_id }} OR
/entityprint/print/{{ entity_type }}/{{ entity_id }}
?
Comment #14
benjy commentedMaybe we should put the type on the end, works quite well.
Comment #15
jordanpagewhite commentedThat's what I thought too, but do we need a /debug for each export_type?
Comment #16
jordanpagewhite commentedI made some more changes based upon my latest work on 2733781. I didn't do much with the tests because we're going to have to change that up a bit anyway to test the different export types. I will try to tackle that soon though.
Comment #18
benjy commentedThanks for working on this, looks like it's shaping up well. Couple of comments below, could you tell me which files I should focus my code review on? Just so it's easier because obviously there is a lot of noise with all the renaming.
Should this be engine_type? It seems export and engine refer to the same thing here. I do actually wonder if export is a better word than engine in general?
"Print" doesn't make sense here, we'll need it to be something like "exported document"
Comment #19
jordanpagewhite commentedYeah, I'll try to summarize what I've done. Hopefully that will at least give you a good start and you can ask other questions if you have them.
I feel like there was probably other changes, but nothing major that I noticed skimming through the patch. A lot of changes to filenames and methods.
Comment #20
benjy commentedPatch doesn't apply for me currently, can you re-roll?
Comment #21
jordanpagewhite commentedSorry. I missed some trailing whitespace. I applied this patch on a new branch and it worked. Let me know if there are any other issues. Thanks.
Comment #23
benjy commentedThe patch still fails to apply, have you done a pull recently and rebased your work?
Comment #24
benjy commentedComment #25
jordanpagewhite commentedOkay, I rebased and I think that all of the merge conflicts were resolved appropriately
Comment #27
benjy commentedSomething went wrong with the merge?
Comment #28
jordanpagewhite commentedSome of the tests weren't updated.
EDIT: Yeah, I guess something went wrong with that directory in the merge. Here's a patch to try to resolve that.
Comment #31
jordanpagewhite commentedI'm going to have to work on the tests more tomorrow. I'm tired.
Comment #32
benjy commentedFixed a couple of tests to help this along.
I reckon we could do this in a follow-up, just keep with only the View PDF link for now.
Comment #34
jordanpagewhite commentedUpdated routes on the tests
Comment #36
jordanpagewhite commentedjust working on the tests
Comment #38
jordanpagewhite commentedI'm not sure that I understand the issues with the tests right now. I might have to tinker with it later if nobody else has a clue.
Comment #39
benjy commentedThis fixes the admin tests with a couple of @TODO's, to make the settings page work with multiple print engines in follow-up issues?
We still need an upgrade path I think although we could do that in follow-ups as well, I'm going to commit this to a 2.x branch, so I don't have any problems with not getting everything perfect here.
Comment #41
benjy commentedThis passes locally, just fixed a hardcoded return in dompdf.
Comment #43
benjy commentedComment #44
benjy commentedI think this is pretty close, couple more comments.
Print an entity to the selected format.
Lets just delete this comment. We don't need them in class files.
We should add a follow-up issue to add the export type to all events. Or maybe add it as a method to the plugin itself? Either way, need a way to access that context.
We just need to create follow-ups for:
Comment #45
jordanpagewhite commentedI took care of your suggestions in #1 and #2. I agree with the follow-up issues. It would probably be easier if these other issues were broken into separate issues too. I can add the follow-up issues if you'd like. I'm pretty sure I could get started on 'Update the settings form for all export types' and 'Test/fix the "View" links for each export type'. Those seem pretty doable. I have never worked on an upgrade path like this. I would be very interested to see how that looks though and contribute however I can.
Comment #46
benjy commentedOK great, do you want to create the issues and then I'll work the upgrade path and you can make start on the others. I'll commit this to a 2x branch shortly.
Comment #47
benjy commentedComment #48
benjy commentedCommitted to 2.x, thanks for the work here.
Comment #50
jordanpagewhite commentedYay!
Comment #51
benjy commentedAdded another follow-up: #2747415: Download PDF action broken in 2.x
Comment #52
benjy commented