- Issue created by @recrit
- @recrit opened merge request.
- Status changed to Needs review
over 1 year ago 9:34pm 23 January 2023 - πΊπΈUnited States recrit
Attached is a static patch of MR 9 that can be used for builds.
The changes made:- Adds an entity local task / tab for the access tokens UI.
- Adds a config setting to enable the new local task. This config setting was added to be less obtrusive for existing sites using access_unpublished. Ideally, this config setting should be removed and then the entity edit form's access tokens fieldset should be removed - this would leave the only UI to be on the new local task.
- πΊπΈUnited States recrit
Updated static patch of MR 9 to manage access tokens on a local task or the entity edit form, but not both.
- πΊπΈUnited States dwisnousky
#6 worked for us! Going to create a patch off of the MR diff to be safe. Nice work! Thank you!
- last update
about 1 year ago 11 pass - π¬π§United Kingdom smaz England, UK
I've been using patch #9 in production for around 2 months now on a very active site & had no issues.
Having a look at the code in more detail, just a couple of minor nitpicks:
+/** + * Implements hook_entity_type_alter(). + */ +function access_unpublished_entity_type_alter(array &$entity_types) { + // Provide link templates for the access-tokens route on all applicable + // entity types. + /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */ + foreach ($entity_types as $entity_type) { + if (AccessUnpublished::applicableEntityType($entity_type) && + $entity_type->hasLinkTemplate('canonical')) { + if (!$entity_type->hasLinkTemplate('access-tokens')) { + $entity_type->setLinkTemplate('access-tokens', $entity_type->getLinkTemplate('canonical') . '/access-tokens'); + } + } + } +}
AccessUnpublished::applicableEntityType already checks for the entity type having the canonical link template, so we probably don't need to check that here too?
+ * Build the access token overview form for the provied entity.
Typo in provided* Subscriber for entity access_unpublish routes.
I think this should be access_unpublishedApart from that, all seems ok - will try to update the merge request with the above.
- last update
12 months ago 11 pass - last update
11 months ago 11 pass - πΊπΈUnited States recrit
adding a static patch of MR9 for builds to use.
- Status changed to RTBC
11 months ago 2:51pm 21 July 2023 - πΊπΈUnited States DamienMcKenna NH, USA
While this works well, I think it might be better to rename the tab to something more meaningful than "Access tokens".