Adding a view_builder to contact form allows us to "render entity" in entity reference which allows form to be embedded basically anywhere, which is awesome.
Eclipse
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | view-builder.patch | 13.6 KB | larowlan |
Adding a view_builder to contact form allows us to "render entity" in entity reference which allows form to be embedded basically anywhere, which is awesome.
Eclipse
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | view-builder.patch | 13.6 KB | larowlan |
Comments
Comment #2
eclipsegc commentedcode!
Comment #3
andypostWhy not use a block for that?
needs doc block
Why? this is a EntityViewBuilder so createInstance() could pass deps
Comment #4
eclipsegc commentedBecause block is just one of many options if we take this approach. Having a view builder on the contact form entity makes a ton of sense and allows us to essentially create custom node types that are contact forms, custom block types as well, or really any fieldable entity can use a contact form reliably now. It also means that contact forms are re-usable in various situations so if you create a contact form add it to a node, and eventually unpublish that node, you don't need to re-create the contact form, just add it to another node and it'll keep collecting data appropriately.
Eclipse
Comment #5
andypostMakes a lot of sense
Comment #6
andypostMakes a lot of sense
Comment #7
andypostComment #8
tim.plunkettSince you're overriding view completely and not calling parent, you need to do the same for viewMultiple.
And at that point, you don't need the rest of the parent class, and it's all useless.
Comment #9
larowlanLooks good, just needs a test - thanks!
Comment #10
davidwbarratt commentedI'm getting this error with the patch from #8:
Comment #11
davidwbarratt commentedThe patch from #2 works perfectly.
Comment #12
tim.plunkettNeeds tests indeed :)
Comment #13
davidwbarratt commentedPatch in #12 worked perfectly for me, but I'll leave the status since we still need tests (#9).
Comment #14
podarok#12 works for me as well
Tested with entity_embed and contact form easily embedded via wysiwyg button.
Cool
Comment #15
emanuelrighetto commentedI can confirm that #12 works like a charm.
Thank you guys.
Comment #16
larowlanWe still need tests here
Comment #17
naveenvalechaAdded webtest for checking whether the contact form is showing. Can we write kerneltest case(will take less time to run) for checking view builder.
Comment #18
larowlanCommitted with the attached cleanup
Comment #19
naveenvalechapatch has not yet pushed to repo
Comment #21
larowlanoh, didn't merge - but was pushed to a branch - checking the release now
Comment #22
larowlanrelease is fine
Comment #24
Strutsagget commentedSo how do i use this?
Can't find anywhere where to add for example as a block.
Comment #25
eclipsegc commentedAdd an entity reference field to a custom block type and reference the contact_form entity type. Then you can add any contact form you've created to a block by simply referencing it. Be sure to set the reference's display to render the full entity.
Eclipse
Comment #26
mvdve commentedYou can also install the drupal 8 version of Ctools. It provides a handy entity_view block which you can use everywhere (blocks, panels, pagemanager etc).
This functionality should be added to the project page, love it!
Comment #27
andypostFiled separate issue for that #2657880: Add hook_help and update project page
Comment #28
dianacastillo commentedI'm tryinng this with entity embed and it does not give me the option to view the entire contact form, only id or link