Hi,
when i try to add an captcha-field to my newsletter-subscriber-block (form) it says the maschine name is too long:
Machine-readable name cannot be longer than 64 characters but is currently 67 characters long.
the maschine name looks like this:
simplenews_subscriptions_block_ec02ad7a-09b9-4072-82d5-702435291c2c
how can i fix this?
best,
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | Screenshot from 2016-11-07 12-38-06.png | 27.22 KB | ModernMantra |
| #15 | interdiff-2799175-11-15.txt | 1.15 KB | ModernMantra |
| #15 | captcha-2799175-15.patch | 2.79 KB | ModernMantra |
| #11 | interdiff-2799175-6-11.txt | 4.54 KB | ModernMantra |
| #11 | captcha-2799175-11.patch | 3.18 KB | ModernMantra |
Comments
Comment #2
ModernMantra commentedHad some little discussion with @berdir. Possible solution is to input from user unique id, if not than generate one. So, for now little progress, will do some more work on this later...
Comment #3
berdirThe default value should be the current uuid configuration. And it should have a description that explains this ID and how it should be used: to have a predictable form ID, if set, the user is responsible for making it unique, if not set, a random value will be generated.
We could also use a shorter mechanism to generate the unique Id, it doesn't have to be a UUID.
Comment #4
ModernMantra commentedSome small improvements considering comment #3 (in addition noticed some redundant parts of code which is removed). Still there has to be done more work especially in two things:
- test coverage
- another method for generating ID
I was trying to find appropriate test class to test the input field. but did not succeed (tried with
SimplenewsSubscribeTestandSimplenewsTestSubscriptionOutputand runned all test in simplenews with breakpoint placed in SimplenewsSUbscriptionBlock but it was not triggered by any test class, or i was doing something wrong)Comment #5
berdirAs discussed, blocks are currently only created through the API.
Comment #6
ModernMantra commentedNow, there is test support. :-)
Comment #8
toncic commentedI think that we need screenshot for this issue, this is kind of UI change.
Comment #9
ModernMantra commentedHere is the screenshot :-)
Comment #10
berdir"Each subscription block must have a unique form ID. If no value is provided, a random ID will be generated. Use this to have a predictable, short ID, e.g. to configure this form to use a CAPTCHA."
Can be simplified to $form_state->getValue('unique_id') ?: ...generate()
existing subscription block tests are I think mostly in SimplenewsSubscribeTest
still no.
Don't just look for a link. Go there and fill out the form. You are just testing the core block UI. Don't, that's not our job. Just go directly to that link and fill out the form.
Forget about drupalPlaceBlock().
We want to check that the value is kept and shown in the settings too, yes. But that should be done in the first test.
Here, we need to assert on the frontpage that the unique ID is actually *used* for the form_id of the form.
Comment #11
ModernMantra commentedMoved the test to SImplenewsSubscribeTest and imprved all stuff pointed in comment #10.
Comment #13
ModernMantra commentedIMHO, test fails are random one and does not have too much to do with my patch, or maybe i am wrong... Setting to needs review to trigger someones revision :-)
Comment #14
berdirthis part can go. just going to the page on the line below is enough for us, those links are the core block UI, we don't need to test that.
this shouldn't be needed.
Comment #15
ModernMantra commentedImprovements considering previous comment :)
Comment #16
ModernMantra commentedIn order to close the issue, we need to check integration together with Captcha module. So by discussion and help from @berdir, installed modules and placed captcha on block. So, it works and attaching the screenshot to verify that.
Comment #18
berdirCommitted.