Hi,
On node pages, contextual links (for editing the current node) are stored/rendered in the $title_suffix template variable. This variable is not rendered within the PageTitle block, and as a result contextual node links are not showing up...
Not sure what a good solution to this problem is, because the Page Title block has its own contextual link ("Configure Block"), so simply rendering $title_suffix inside the block will probably lead to a visual conflict. I guess for me it would make most sense to have the contextual node links attached to the main page content (i.e. the node display)...
Any tips on how to do that? Ideas for a "proper solution" or for what a patch should look like?
Ben
Comments
Comment #1
bforchhammer commentedHm, I managed to get them to display by overriding omega's
node.tpl.phpand moving the$title_beforeand$title_afteroutside the<header>tag (see patch).Should this maybe be changed in omega? I don't know if
$title_beforeand$title_afterare used for anything else, but if contextual_links are the only usecase then it would probably make sense!?Comment #2
bforchhammer commentedAlso, on a similar note I found that contextual links were not being rendered for views pages either.
The source of that problem lies in views module's implementation of contextual links: #876772-6: Better contextual link integration for blocks and pages
The Omega theme does not render the
$title_suffixvariable on the page level, preventing contextual links from being displayed.The following hook solves the problem for me. Note that the location of the "main content block" (system_main) may by different depending on the theme, so this might have to be adjusted for other themes...
As a side effect this also fixes #1284872: All Contextual Links are triggered..
Comment #3
marcoka commentedthe patch does not fix it for me. in my opinion this is a bug not a feature request.
Comment #4
marcoka commentedComment #5
rlhawkHere's the workaround I'm using for now to solve this issue. The code is largely taken from Views's views_preprocess_html function. The problem is that the class that Views looks for in that function (views_contextual_links_info) is not in the HTML template in Omega; it's in the Page template. Ultimately, it would good to fix that in Omega, if it doesn't break something else. In the meantime, this theme preprocess function should work. It should go either in preprocess/preprocess-page.inc or in template.php.
Comment #6
himerus commentedThe actual solution for this is quite simple via a quick template edit.
The
<?php print render($title_prefix); ?>and<?php print render($title_suffix); ?>should appear outside of the conditional<?php if ($title): ?>This fix is going in the 3.1 release
Comment #7
himerus commentedForgot to mention that this template edit is in region--content.tpl.php for page level title rendering, and also in node.tpl.php for default teaser type title rendering.
Comment #8
bforchhammer commentedThanks himerus, that's good news :-)
Comment #9
echoz commentedI submitted this patch #1270552: $title_prefix, $title_suffix not outside "if ($title)" in region--content.tpl.php (just for region--content.tpl.php), but it fell between the cracks, and today got marked as duplicate even though it preceded this issue by over a month. Also, when marking as duplicate, it's helpful to indicate the issue it is a duplicate for.
Comment #10
amaria commentedYeah this doesn't work for me either on node teasers. The title_prefix element is empty. The title_suffix element contains the contextual links but the links are not appearing.
Comment #11
amaria commentedScratch that. It does work. It just doesn't work with Contextual Flyout Links. Bummer.
Comment #12
amaria commentedFor anyone interested in making Contextual Flyout Links work for all regions in Omega, try my patch.
Comment #14
mixhael commentedThe issue that the whole page of a view becomes a contextual links region, resulting in all contextual links being triggered at once is still not solved. I posted it here: http://drupal.org/node/1326744, but it was recommended to continue in this thread
Comment #16
cellar door commentedfubhy - any thoughts as to why this would be happening?
Comment #17
rlhawkHere is the code I'm using to address the Views contextual links issue. It's a shorter version of what I posted above, without the drupal_add_js, since the necessary JS is already added by Views. It's not a perfect solution, but it removes the contextual link trigger from the whole page. The code should go in either THEMENAME/preprocess/preprocess-page.inc or THEMENAME/template.php.
Comment #18
rlhawk"test" is the name of my theme, in the code above. Of course, change it to whatever your theme name is.
Comment #19
broonEDIT: Well, turns out the core module "Contextual Links" got deactivated along the way of creating and developing a subtheme. Re-enabling shows all the contextual links again and I can confirm that 3.1 (and 3.1+4-dev) has all contextual links in the right spot.
EDIT 2: Now that contextual links are present again, I experience the issue with triggering all contextual menus by entering viewpoint. Patch from #17 resolves that issue. When hovering main content on view pages, contextual menus are triggered for both views and all nodes but this also happens with Bartik; so it's not Omega related.
Cheers,
Paul
Hey there,so I ran into a similar bug. There are no contextual links displayed at all, neither for node pages nor for views.
While using 7.x-3.1,
$vars['page']contains correct'#contextual_links'as well as'#views_contextual_links_info'; however, both$vars['title_prefix']and$vars['title_suffix']are empty arrays.The HTML ouput contains no divs for title's suffix/prefix. I tried all provided patches as in #2, #5 and #17 to no luck.
I tried Omega 7.x-3.1+4-dev (currently latest dev) but again no change.
What am I missing? On which level within
$varsshould'#contextual_links'and'#views_contextual_links_info'reside to be rendered or, respectively, at which point are these attached to title_suffix?Thanks in advance,
Paul
Comment #20
cellar door commentedShould this be sent to Views as an issue or added to 3.2 in the template.php?
Comment #21
Wickedweb.Mark commentedTried and tested fixes to all but fail.
Resorted to nasty hack as per below:
Comment #22
tregismoreira commentedHey guys, somebody founds a definitive solution for this boring issue (without jquery)?
Comment #23
tregismoreira commentedWow, #2 works perfectly for me! Thanks a lot ;)
Comment #24
kkasischke commentedThe patch in this Views issue worked for me: Contextual links added to page element if 'page' view is displayed
Comment #25
steinmb commented7.x-1.x is unsupported, closing.