Closed (fixed)
Project:
Contact Storage
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 May 2016 at 06:05 UTC
Updated:
29 Aug 2016 at 06:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
larowlanComment #3
larowlanComment #4
Bambell commentedComment #5
Bambell commentedHere we go. I also added a test.
Comment #6
Bambell commentedComment #7
berdirYou have set the link templates twice now. entity_type_build() should not be needed.
not 100% sure about what we allow and don't allow yet. Possibly we want to only disallow view.
Clicking them is always a bit tricky in the last, but can we check that we see the expected enable/disable links as many times as we expect them on the overview page?
Lets add a assertResponse(403) / 200 as well.
Comment #8
Bambell commentedThere, should be good. I'm now allowing update rights on disabled forms (why not, indeed).
Comment #9
Bambell commentedComment #10
larowlannit ===
fwiw you could use $this->cssSelect('li.disable a:contains(Disable)') here
Looks good to me
Comment #11
larowlanThinking more about this, I'm not convinced that an access-denied approach is what we want every-time here (yes I mentioned access controller above). Maybe instead we add the option of a configurable 'this form is closed' message to the contact-form type.
And then in the view-builder, instead of rendering the form, we render that message.
So for cases where the user is embedding the form in a node/block etc - the render would render the message and not the form.
E.g. Someone creates a node about 'Submit a tender' or 'Enter this competition' and embeds a form in it using the view builder and an ER field with rendered entity formatter.
After this change, the form would not be shown but with no indication of why.
If we allowed for a configurable message, this would show instead - so the site builder/admin could make it say 'Thank you submissions for this tender have closed' or 'This competition ended on May 15th'.
We could collect the text from the disable form. No text = access denied.
Thoughts?
Comment #12
andypostAdditionally to #11 we have following in
contact_storage_entity_type_alter():Introduction of
contact_storage_contact_form_access()makes module less flexible cos there's no way to override this access control...So I put this back to NR to at least implement access handler and continue discussion about meaning of "disabled vs prevent submissions"
My big +1 to introduce another third party setting to "close submissions"
Suppose it's time to implement access control handler!
Comment #13
andypostNW to get rid of
contact_storage_contact_form_access()Comment #14
berdirA forbidden can't be overridden, even less so in an access control handler. I don't see a reason to do that.
I thought about the message, but that would be quite a bit more complicated. We need to alter the route to be able to do that. That could conflict with custom code already doing that.
Comment #15
dawehnerHere are some small fixes.
In general I'm a bit confused how the operations ever worked.
Comment #16
andypostLooks great for me!
Comment #17
berdirI still think we could do without our own access class, but works for me.
Comment #18
zerolab commentedAttaching a re-rolled patch against latest 8.x-1.x as the patch from #15 failed to apply because of recent commits.
Comment #20
Bambell commented@zerolab, thanks for the patch. Tests are failing, though, so I re-rolled #15 and made the
cssSelectchange recommended in #10.Comment #21
Bambell commentedComment #22
zerolab commentedCheers!
Just looked at my patch, it looks like I failed to
git add .and it was missing theContactFormDisableFormandContactFormEnableFormclasses :-(The tests are back to green and since it is a re-roll, RTBC?
Comment #23
larowlanI still think we need to be able to show a message when the form is embedded instead of access denied.
Does anyone else feel this way?
Comment #24
andypostI think that should be configurable
Comment #25
Bambell commentedHere we go with a configurable message instead of denying access.
Comment #26
berdirI think above, @larowlan had the idea to (additionally?) show this on the disable confirm form. I think that would be quite nice, as you are reminded of the message when disabling the form.
I thought those shouldn't be needed as we get them by default?
This is a frontend/user facing output. We might want to give users more flexibility to configure this. Probably create a template and pass in the contact form and the message as variables?
The default output can still be the same.
weight is not needed I think as nothing else is on that page.
a comment for this would be good. Something like // Add required cacheability metadata from the contact form entity, so that changing it invalidates the cache.
I think a comment here that explains why we override this would be good. Something like "This is an override of ContactController::contactSitePage() that uses the entity view builder. This is necessary to show the close message for disabled forms.
Comment #27
Bambell commentedI made those changes, including adding a template for the disabled form message and adding the disabled message textfield to the form to disable the forms..
Nope. the links won't show without this.
Comment #28
berdirGetting close I think, good work.
Lets check those operations tomorrow, please remind me when you work on this.
templates usually use -, not _. Then you don't need to specify it explicitly.
I think it is easier to just provide both variables directly in the render array. You don't need a detached preprocess function then. Sometimes, those are useful (when using render element, for example), but for such simple things, just passing things in directly is easier to follow.
I think the fallback should use t(), also in the other place. So when your site is spanish, you get a spanish message by default.
Just the inner div is enough I think, the two outer ones are actually provided by the wrapper already, and you'd end up with them duplicated.
Comment #29
Bambell commentedHere's for now, still with
contact_storage_entity_operation().Comment #30
Bambell commentedHere we go !
Comment #31
larowlanLooking great @Bambell
Should we translate the default here?
nit: we could use
::classhereComment #32
Bambell commentedThanks for the review @larowlan ! Here are the changes.
Comment #33
larowlanThanks!
Will commit this later in the week unless someone beats me to it.
Comment #34
chandeepkhosa commentedComment #35
larowlanThanks