I just rebuilt my dev environment, and on install, the admin/workbench throws an error:

Notice: Undefined index: #contextual_links in contextual_pre_render_links() (line 140 of /Applications/MAMP/htdocs/drupal-7-workbench/modules/contextual/contextual.module).

And the contextual links for the Views don't work. There seems to be a mismatch between the use of 'contextual_links' and '#contextual_links' in the render array, but I can't figure out how to correct for it.

See workbench_content() and theme_workbench_element() compared to http://api.drupal.org/api/drupal/modules!contextual!contextual.module/fu...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

Status: Active » Needs review
FileSize
1.07 KB

This patch removes the error, but the contextual Views links are still broken.

robeano’s picture

Issue tags: +Workbench Sprint

Yep, I'm noticing this too. The PHP Notice occurs only when there is no content on the site.

Contextual links are broken still broken.

hass’s picture

How can I reproduce this and what contextual links are broken? I have not seen it and all my contextual links seems working.

agentrickard’s picture

Status: Needs review » Closed (cannot reproduce)

This does seem to be fixed now. I suspect some other change corrected the issue.

agentrickard’s picture

For some reason, however, the links appear in an odd place. Which may be why I missed them.

bbinkovitz’s picture

Status: Closed (cannot reproduce) » Needs work

I think it must be a mistake that this was marked "Closed (cannot reproduce)" since several people are able to reproduce it. I, for one, have encountered it just now on my fresh sandbox.

hass’s picture

Are you able to describe how and under what url? Maybe add screenshots, too.

bbinkovitz’s picture

Whenever I visit /admin/workbench, the next page that I visit after I close the overlay looks like this. (Screenshot attached).

Enabled contrib modules are: CTools, Devel, Git Deploy, Views 7.x-3.x-dev, and Workbench 7.x-1.2.

hass’s picture

You do not have WBM or WBA installed?

hass’s picture

Status: Needs work » Needs review

How about the patch from #1?

bbinkovitz’s picture

I do not have WBM or WBA on this particular test site.

I still get the errors when I try the patch in #1. Only disabling the contextual module seems to get rid of it.

hass’s picture

Status: Needs review » Needs work
bbinkovitz’s picture

Status: Needs review » Needs work
FileSize
108.32 KB
3.57 KB
2.49 KB

I got the patch to apply and wrote some tests.

Attached you'll find the patch with tests, as well as tests only. The tests will not fail without the patch, however, they will display exceptions as shown in the attached screenshot. With the patch applied, the tests will pass without exceptions.

I have so far not observed misplacement of the contextual links.

bbinkovitz’s picture

Status: Needs work » Needs review
hass’s picture

We need to rerole for #1388220: Actions Missing in My Edits. Additional I think there is something wrong with this patch.

+++ b/workbench.pages.incundefined
@@ -60,7 +60,7 @@ function workbench_content() {
-        views_add_contextual_links($output[$key]['contextual_links'], 'block', $view, $display_id);
+        views_add_contextual_links($output[$key]['#contextual_links'], 'block', $view, $display_id);

I believe it need to be $output[$key] only. The rest is handled by views_add_contextual_links(). I say this only codewise, so it's not tested yet, but I give it a try. By prefixing the name with a sharp you made it falling back to sane defaults if I'm not totally wrong.

hass’s picture

Status: Needs work » Needs review
FileSize
3.7 KB

I'm still totally unable to repro this warnings. I have installed only workbench module and no WBA or WBM. Drupal 7.18

drupalmonkey’s picture

I had this same issue, but I didn't have views_ui enabled. After enabling Views UI, the error went away. (This is without using any of the aforementioned patches on this thread).

Does anyone get the error WITH Views UI enabled? The contextual link code should check for Views UI anyway, and that made it into a commit on this issue: http://drupal.org/node/1388220

hass’s picture

Status: Needs review » Closed (duplicate)

Ok, reproduced it. Views UI need to be disabled and if (module_exists('contextual') && module_exists('views_ui')) { need to be roled back to if (module_exists('contextual')) { for repro. So, this is a duplicate of #1388220: Actions Missing in My Edits.

hass’s picture

Stop, there are tests inside.

hass’s picture

Status: Closed (duplicate) » Needs review
FileSize
3.57 KB
hass’s picture

Title: Contextual links error on Drupal 7.15 » Test contextual links
FileSize
3.52 KB
  • #13 has disabled the contextual links completely.
  • Patch has now no missing newline in .info.
  • Added test coverage if the contextual links are really shown
hass’s picture

+++ b/workbench.testundefined
@@ -0,0 +1,68 @@
+    // Navigate to the Workbench dashboard, then back to the frontpage to get errors in the contextual filter module
+    $this->drupalGet('/admin/workbench');

$this->drupalGet('admin/workbench')

Contextual links are not appearing. This is JS, isn't it? I'm out for tonight... looks not testable :-(.

Status: Needs review » Needs work

The last submitted patch, workbench_1727284+Test+contextual+links.patch, failed testing.

bbinkovitz’s picture

The test I posted doesn't test whether the contextual links are in the right place or even whether they work. Rather, the test generates errors without the patch, and does not generate errors when the patch is applied. That is all.

bbinkovitz’s picture

Status: Needs work » Needs review
bbinkovitz’s picture

The commit that fixed #1388220: Actions Missing in My Edits also resolved this problem for me. Queued the tests from #13 for re-testing because I think they will not produce errors on the latest codebase.

Update: they now pass with no errors. I believe this is fixed.

bbinkovitz’s picture

Status: Needs review » Reviewed & tested by the community
bbinkovitz’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
hass’s picture

Status: Closed (duplicate) » Needs work

#21 needs work.

bbinkovitz’s picture

I'm confused. What needs work? Is it not true that pulling the latest dev resolves this issue?

drupalmonkey’s picture

I think hass wants to get the tests in. I'm not sure they work correctly yet though.

hass’s picture

Yep, I'd like to get the tests in for future.

realityloop’s picture

Status: Needs work » Needs review
gilsbert’s picture

Hi.

I tested patch #16 and it is working.

Will it be added to the official release?

Regards,
Gilsberty

BarisW’s picture

I've pulled the latest dev and the issue is gone. So the Needs work only applies to getting the tests in, the rest is not needed.

ebeyrent’s picture

Issue summary: View changes

Using the latest stable version (7.x-1.2) and with Views UI disabled, I'm getting the warnings:

Warning: Invalid argument supplied for foreach() in contextual_pre_render_links()

To recreate, add a view of some sort with a page display, add a tab menu that appears within workbench (admin/workbench/my-view).

Any chance of getting this fixed soon? I don't like to have Views UI enabled on production, but I also dislike warnings and errors.

ebeyrent’s picture

Any updates on this?

mkhamash’s picture

Patch #1 does the trick and it seems fairly logical.

vids’s picture

Patch from #1 works perfectly fine for me.

ElliotFriend’s picture

Patch #1 also works for us. We're in the same situation as you, @ebeyrent: Workbench 7.x-1.2, views_ui disabled. Works great!

leolandotan’s picture

I'm also having this issue and as stated by @bbinkovitz on comment #8, this can be reproduced by going to the admin/content/workbench page or just visit the page more than once like just refresh the page the error them is shown.

Indeed the patch in comment #1 removed the error.

Some modules versions used

  • Drupal Core 7.41
  • CTools 1.9
  • Workbench 1.2
  • Views 3.11 (Views UI Disabled)
joaocsilva’s picture

In my case the module views_ui was disabled and for some reason it was causing the problem.
Without any patch and enabling the module views_ui the error went away.
Maybe it can help someone.