Steps to reproduce:
1. Visit admin/config/search/search-api/add-index
2. Enter name, Select content, and select any server other than "- No server -" (ie: Solr or Database server)
3. Press Save and Edit
Expected output: Goes to Index edit form
Actual output: Goes to 'View' index.
The only case when it works is when you select 'No server', because no batch is create, but even then it does not redirect to 'Edit', but to 'Fields'.
I suggest to remove 'Save and Edit'. The method Drupal\search_api\Form\IndexForm::save() is creating a batch, so '::redirectToFieldsForm' never gets called.
If you agree, I can submit a patch for it ...
Comment | File | Size | Author |
---|---|---|---|
#15 | 2575641-15--fix_save_and_edit.patch | 3.07 KB | drunken monkey |
|
Comments
Comment #2
drunken monkeyFrom the batch operations structure that gets created (you see when debugging) I'd actually have thought that after the batch this should/would redirect to "Fields" (not "Edit"), like before we had the batch. However, you are right, this does seem to mess with things. I think we should rather remove the "Save" button and make the redirect work – but I have no idea, how, myself, I have to admit. Maybe we need to adapt the batch's "finished" callback?
In any case, thanks for reporting the issue!
Comment #3
drunken monkeyThis is definitely a release blocker. If we can't get it to work, we should remove the button. (It already works correctly when creating a disabled index, but that's probably too uncommon to be worth anything.)
Comment #4
rbayliss CreditAttribution: rbayliss at Last Call Media commentedIt seems like as soon as that batch is set, no other submit callbacks will run. Here's one way to fix it, although it's a bummer that this form could never have additional submit handlers (like if I needed to add one in another contrib module).
Comment #5
dazz CreditAttribution: dazz at iO commentedThis seems to fix it but shouldn't the button say "Save and add fields", since it redirects to the add fields page?
Comment #6
borisson_@dazz: that sounds like a good idea, can you change that?
Comment #7
dazz CreditAttribution: dazz at iO commentedComment #8
borisson_Comment #10
dazz CreditAttribution: dazz at iO commentedAdjusted the test.
Comment #11
borisson_Back to rtbc, looks great.
Comment #12
drunken monkeyYes, does look pretty good. Thanks!
Just corrected two comments (Joris didn't spot a premature line wrap – the end is nigh! ;O) and changed to an – in my opinion – slightly neater way of specifying which URL to redirect to.
If everyone's fine is this, I can commit.
Comment #13
drunken monkeyComment #15
drunken monkeyOK, this would fail when creating a new index – makes sense.
Comment #16
borisson_Comment #18
drunken monkeyThanks a lot for reviewing!
Committed.
Thanks again, everyone!