I have a page managed page that renders the contextual links outside of the contextual links region, rendering them inactive. I think the issue base something to do with the order of the code in 'ctools/includes/context-task-handler.inc' in the 'ctools_context_handler_render_handler()'. If i change the order of the code in the function, then the links appear. I have attached screen grabs that illustrate the issue and how I solved the problem.
Before (line 178):
if (!empty($links) && is_array($links)) {
$build = array(
'#theme_wrappers' => array('container'),
'#attributes' => array('class' => array('contextual-links-region')),
);
if (!is_array($info['content'])) {
$build['content']['#markup'] = $info['content'];
}
else {
$build['content'] = $info['content'];
}
$build['contextual_links'] = array(
'#prefix' => '<div class="contextual-links-wrapper">',
'#suffix' => '</div>',
'#theme' => 'links__contextual',
'#links' => $links,
'#attributes' => array('class' => array('contextual-links')),
'#attached' => array(
'library' => array(array('contextual', 'contextual-links')),
),
);
$info['content'] = $build;
}
}
After:
if (!empty($links) && is_array($links)) {
$build = array(
'#theme_wrappers' => array('container'),
'#attributes' => array('class' => array('contextual-links-region')),
);
$build['contextual_links'] = array(
'#prefix' => '<div class="contextual-links-wrapper">',
'#suffix' => '</div>',
'#theme' => 'links__contextual',
'#links' => $links,
'#attributes' => array('class' => array('contextual-links')),
'#attached' => array(
'library' => array(array('contextual', 'contextual-links')),
),
);
if (!is_array($info['content'])) {
$build['content']['#markup'] = $info['content'];
}
else {
$build['content'] = $info['content'];
}
$info['content'] = $build;
}
}| Comment | File | Size | Author |
|---|---|---|---|
| after.png | 15.49 KB | simonp98 | |
| before.png | 12.43 KB | simonp98 |
Comments
Comment #1
mustanggb commented