WIP: Allow creating per bundle/ per group roles#209
WIP: Allow creating per bundle/ per group roles#209amitaibu wants to merge 5 commits intodefault-rolesfrom
Conversation
|
@pfrenssen this is just a beggining, but maybe can already give you a hint on my direction |
| * @see \Drupal\og\GroupManager::createPerGroupRoles() | ||
| */ | ||
| protected function createRoles($entity_type_id, $bundle_id) { | ||
| protected function createRoles($entity_type_id, $bundle_id = NULL, $group_id = NULL) { |
There was a problem hiding this comment.
@pfrenssen I guess it is a bit ugly having to pass either bundle ID or group ID. Which made me thing that maybe we should have two Og Roles bundles: per_bundle and per_group so the schema will just have those two keys: group_type and reference_id (bad name) . reference_id will be populated either with the bundle ID or the group ID.
There was a problem hiding this comment.
OgRole is a config entity, I don't think this supports bundles. If you look at the inherited method OgRole::bundle() you see it returns the entity type instead of the bundle. Only content entities support custom bundles out of the box.
But I actually think we can hack in bundle support easily. We just need to ensure that the bundle is stored along with the entity, that we have a $this->bundle property that we populate in the constructor, and then we can use it to handle per_bundle and per_group specific logic.
|
Here are some thoughts:
@pfrenssen what do you think about 4? Not sure how to tackle it, and still be able to share code between the classes. |
|
Assigning to me so I won't forget to review this and answer the questions. |
|
A possible solution to having to reference both So This means we can break it to smaller PRs:
|
#208