Skip to content
Snippets Groups Projects

Menu UI sections links

2 unresolved threads

Closes #3419151

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Lee Rowlands
  • Lee Rowlands
  • Lee Rowlands
  • Lee Rowlands
  • 30 private readonly RouteProviderInterface $routeProvider,
    31 private readonly EntityTypeManagerInterface $entityTypeManager,
    32 private readonly AccountInterface $currentUser,
    33 TranslationInterface $stringTranslation,
    34 ) {
    35 $this->setStringTranslation($stringTranslation);
    36 }
    37
    38 /**
    39 * Implements hook_form_alter().
    40 */
    41 public function formAlter(&$form, FormStateInterface $form_state, $form_id): void {
    42 if ($form_id !== 'menu_edit_form') {
    43 return;
    44 }
    45
    • Comment on lines +44 to +45

      I think we could add a check for the assign workbench access permission here and avoid doing anything if that's not present - all the links likely require that

    • the access method is already used elsewhere, which in turn checks this perm.

      ive added extra coverage in case access is modified.

      site note: i would have expected WBA to also have a checker for view/view-label for the scheme OR scheme+section

    • Please register or sign in to reply
  • Lee Rowlands
  • 184 }
    185 }
    186 }
    187
    188 /**
    189 * Gets canonical routes for entity types.
    190 *
    191 * Code is similar to how entity_route_context reverse engineers paths from
    192 * link templates to routes.
    193 *
    194 * @return array<string, string>
    195 * Entity type ID keyed by canonical route name.
    196 */
    197 private function getEntityTypeRoutes(): array {
    198 $entityPaths = [];
    199 foreach ($this->entityTypeManager->getDefinitions() as $entityType) {
    • you can probably limit this to content entities:

      • the taxo scheme has a gate on content entities
      • the menu scheme only works for nodes because it uses menu_ui_get_menu_link_defaults
      • in contrib EH is limited to content entities
    • well even if thats true in practice, the tests use entitytest, so at least the these links are agnostic, in case something changes in the future.

    • Please register or sign in to reply
  • Nice work, quite a lot of processing to do there, but nicely done to make it do as much bulk work as possible

  • dpi added 1 commit

    added 1 commit

    • 8c9bc53a - feedback, improve access denied for link + tests, moved views test fixtures to...

    Compare with previous version

  • Please register or sign in to reply
    Loading