Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In forum.module in function forum_help(), there is the following code:
$output = '<p>' . t('Forums contain forum topics. Use containers to group related forums.') . '</p>';
$more_help_link = array(
'#type' => 'link',
'#href' => 'admin/help/forum',
'#title' => t('More help'),
);
$container = array(
'#theme' => 'container',
'#children' => drupal_render($more_help_link),
'#attributes' => array(
'class' => array('more-help-link'),
),
);
$output .= drupal_render($container);
This shouldn't be hard-wiring the admin/help/forum link. It should be using
\Drupal::url('help.page', array('name' => 'forum'))
Should be a good Novice task to fix this, I think?
Comment | File | Size | Author |
---|---|---|---|
#8 | drupal-forum-hook-help-use-route-2250335-8.patch | 950 bytes | pingwin4eg |
#6 | cleanup-forum_hook_help-2250335-6.patch | 1.04 KB | drupaledmonk |
#3 | cleanup-forum_hook_help-2250335-2.patch | 1.12 KB | drupaledmonk |
#1 | cleanup-forum_hook_help-2250335-1.patch | 596 bytes | drupaledmonk |
Comments
Comment #1
drupaledmonk CreditAttribution: drupaledmonk commentedHelped me understand routes. :)
Comment #3
drupaledmonk CreditAttribution: drupaledmonk commentedComment #4
drupaledmonk CreditAttribution: drupaledmonk commentedComment #6
drupaledmonk CreditAttribution: drupaledmonk commentedComment #7
jhodgdonThanks for taking this on!
So... I don't actually think we want to get rid of the render array structure that was being used here. I just think we want to get rid of:
and use a route instead.
Take a look at:
https://api.drupal.org/api/drupal/core!includes!common.inc/function/drup...
It looks like instead of #href, you can use #route_name in a '#type' => 'link' render array.
Thanks!
Comment #8
pingwin4egPatch made @ #dcdn code sprint. Please review.
Comment #9
sanchiz CreditAttribution: sanchiz commentedComment #10
dawehnerPerfect!
Comment #11
tim.plunkettCan we please wait for #2183113: Update hook_help signature to use route_name instead of path?
Comment #12
jhodgdonI do not think this patch conflicts with #22183113, does it? That patch in this area has:
and this one has:
so it looks like they neatly manage to avoid hitting each others' context.
And you might want to tag the other issue "avoid commit conflicts".
Comment #13
alexpottCommitted 04d9f33 and pushed to 8.x. Thanks!