Lightbox trigger in Views

scubasmurf - September 13, 2009 - 06:38
Project:Lightbox2
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:critical
Assigned:Unassigned
Status:fixed
Description

Hi,

I am using Lightbox trigger in Views and generally its working pretty well. The problems I am having are:

1) The following error message is displayed, once for each thumbnail on the page:

warning: Missing argument 1 for views_handler_field::get_render_tokens(), called in /example/modules/lightbox2/lightbox2_handler_field_lightbox2.inc on line 113 and defined in /example/public_html/modules/views/handlers/views_handler_field.inc on line 639.

2) After pressing the next image button, the first image disappears, then reappears for a second, then the second image appears.

Does anyone have any suggestions?

#1

stella - September 13, 2009 - 22:39
Status:active» postponed (maintainer needs more info)

first issue - can you try clearing your Drupal cache (admin/settings/performance)?

#2

scubasmurf - September 14, 2009 - 00:21

That was the second thing I tried. I have done it again just to make sure. I also cleared the views cache.

No change to either problem.

#3

Crell - January 12, 2010 - 23:12
Status:postponed (maintainer needs more info)» active

This is actually an API change in Views 2 that I just tracked down. Compare views_handler_field::get_render_tokens() from 2.6 to 2.7:

http://drupalcode.org/viewvc/drupal/contributions/modules/views/handlers...

http://drupalcode.org/viewvc/drupal/contributions/modules/views/handlers...

Note the addition of a new method parameter, which the Lightbox trigger handler doesn't know about because it was written for 2.6.

I'm not entirely sure what $item is supposed to be, as there is no mention of it in the DocBlock. We should probably check with merlinofchaos.

And oh yeah, we could really use another stable release after this is fixed. :-)

#4

mokko - January 26, 2010 - 07:25

Good work, Crell! I am trying to find out how to use the views function and run into the same problem. I guess there is no news yet, otherwise we'd already know.

#5

glennnz - January 26, 2010 - 10:32

Subscribing.

Crell, fantastic work on the Lightbox2 patch, love your work.

:-)

Glenn

#6

glennnz - January 26, 2010 - 11:01

Ditto for scubasmurf's original second issue.

#7

mokko - January 26, 2010 - 15:56
Priority:normal» critical

i mark this as critical since i don't see how dev works without current version of views. Correct me when I am wrong.

By the way, now we are at views 2.8 which looks the same to me in this respect:
http://drupalcode.org/viewvc/drupal/contributions/modules/views/handlers...

Edit: I am not at home and cannot patch from here, will try to provide at least a more current error message. Hopefully tonight.

#8

mokko - January 26, 2010 - 20:33

warning: Missing argument 1 for views_handler_field::get_render_tokens(), called in /var/www/vhosts/mimo-project.eu/httpdocs/sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc on line 113 and defined in /var/www/vhosts/mimo-project.eu/httpdocs/sites/all/modules/views/handlers/views_handler_field.inc on line 642.

No big difference, only 3 lines of code.

Edit:
Now, I am only guessing, but it seems to work like if you fill in $values
$this->get_render_tokens($values) in 130

Not sure since I am still trying to figure out how it is supposed to work.

#9

mfer - January 26, 2010 - 21:49

I believe the attached patch fixes the problem.

What gets passed into get_render_tokens() is the $this->options['alter'] or an individual item + the alter. An item would be something like:

<?php
  $raw_items
= $this->get_items($values);
  foreach (
$raw_items as $count => $item) {
   
$alter = $item + $this->options['alter'];
   
$items[] = $this->render_text($alter);
  ...
?>

In this case I set it to pass in just $this->options['alter'].

AttachmentSize
lightbox2-575926_9.patch 812 bytes

#10

mfer - January 26, 2010 - 21:50
Status:active» needs review

#11

glennnz - January 26, 2010 - 23:50

Works great for me

:-)

Thanks, this is great.

#12

glennnz - January 27, 2010 - 02:23

@Crell

Another request would be to allow php in the popup.

Could this be done using a .tpl.php file?

Cheers

Glenn

#13

Crell - January 27, 2010 - 17:43

glennz: I'm not the maintainer of this module. :-) Also, please do not add new feature requests to an existing bug thread. It makes it very hard to follow.

#14

mokko - January 28, 2010 - 08:05

#9 seems to work for me, too!

(although i see no difference to my likely wrong suggestion from #8)

Thanks!

Is this enough review?

#15

marvil07 - February 18, 2010 - 07:46

I did not reviewed the api changes in views, but here as end user I can say #9 just works :-)

#16

srobert72 - March 6, 2010 - 10:03

Subscribing

I have same error :
warning: Missing argument 1 for views_handler_field::get_render_tokens(), called in /home/drupal/sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc on line 113 and defined in /home/drupal/sites/all/modules/views/handlers/views_handler_field.inc on line 642.

I will try patch#9

EDIT:
Works but with errors.
See: #718566: View trigger for Lightbox2 not opening the lightbox

#17

stella - March 7, 2010 - 17:36
Status:needs review» fixed

Committed, thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.