Closed (fixed)
Project:
Content locking (anti-concurrent editing)
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Oct 2017 at 10:35 UTC
Updated:
16 Nov 2017 at 11:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hchonovComment #4
kfritscheFixed the current tests and found a small issue, which I needed to fix if form op is not used.
New tests would be nice, but not sure if I get to it soon :/
Comment #5
kfritscheComment #6
kfritscheFixing notice on the settings form which will be introduced when applying #2911446: Add an option to the configuration form for selecting all bundles
Comment #7
hchonovThank you, @kfritsche!
One not really important nit:
We need to add a new line at the end of the file.
After thinking about this feature over again, I think that on the settings form we should disable the opposite list when checking form operations on one of the lists. I mean if a user selects a checkbox on the black list, then the options on the white list should be disabled and on form submit the white list should be saved empty. What do you think about this?
Comment #8
kfritscheI agree to you proposal and would suggest to re-do it with 3 radio buttons (off / white list / black list) and only one time with the form ops checkboxes.
As a Drupal user is kind of familiar with this behavior from the block pages config -
Comment #9
kfritscheRefactored config for this patch. I think the config is now better and more readable.
The new structure is now:
This changed is also reflected in the admin UI having per entity a radio with 3 options and the form ops checkboxes if whitelist or blacklist is selected.
Comment #11
hchonov@kfritsche++ I like your idea better than mine :)
Unfortunately the schema is not entirely correct. We need one parent level for the entity type :).
Comment #12
hchonovWe also have to consider #2911532-26: Lock on entity translation level instead on entity level - we have to add an update hook and create the column for the langcode, which we've missed in the other issue, and also add the column for the form operation.
Comment #13
kfritscheRe-roll and fixed the issue mentioned above. This should then also fix the tests, as the test failed on the schema validation.
Comment #14
hchonovLook great now. Thank you!
Comment #15
chr.fritschTBH, i have no idea how to test this. Do you have some guidance for me?
Comment #16
hchonovLets assume your custom module's name is "
custom_module".1. Navigate to
http://d8/admin/structure/display-modes/formand create a new form mode named "settings", which makes sense if it has different fields defined than the default or the edit form display mode - for this save the new form mode with different fields underhttp://d8/admin/structure/types/manage/article/form-display.2. Then in
custom_module.moduleyou have to define the new form operation on the entity type:3. In
custom_module.links.task.ymlcreate the link:4. In
custom_module.routing.ymladd the route:5. drush cr :)
What we've achieved now is that we have a new form display using its own form operation and it has edit access to different fields than the edit/default form mode. Now if we have two completely different form displays with no common fields the
conflictmodule will be able to automatically merge the fields if two users concurrently saved both forms - the edit one and the settings one and therefore removes the need for locking the whole entity.P.S. I hope that I've provided all the steps needed to create a new form operation and form using it, please don't blame me if I am missing something :).
Comment #17
chr.fritschThank you for the guide. It seems that something is missing ;) I get a 403 when i enter node/6/settings.
Comment #18
hchonovI think you have to add a requirement to the route definition e.g.
So that the route definition looks like this :
Comment #19
chr.fritschThank you. Now i was able to test it and i really love it.
I have just one remark about the settings page. It's getting a bit confusing now, because the entity type label and "Lock only on entity form operation level." are in the same font style.
Comment #20
kfritscheYou are right, settings form got a mess.
So I tested around a little bit and checked out other forms in core, what they do. I thought its best comparable with content language form (admin/config/regional/content-language), so I styled it a bit like that.
With this layout its also easy to add per bundle configs if needed. I'm unsure if useful, but if needed I would review that patch :P
Also when selecting an entity type above the settings, it auto selects all at the beginning.
I think this is now way better than before.
Comment #22
chr.fritschThank you, the settings form looks much nicer now.