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.
Backport #2530634: Value of last_render_text leaks into the next Dropbutton.
This is the code I'm using at the moment.
Is $this->view->row_index
equivilant to $values->index
?
views_handler_field.inc
class views_handler_field extends views_handler {
...
public $additional_fields = array();
+ protected $last_render_index;
+
/**
* Construct a new field handler.
*/
...
public function advanced_render($values) {
+ // Clean up values from previous render calls.
+ if ($this->last_render_index != $this->view->row_index) {
+ $this->last_render_text = '';
+ }
+
...
+ // If we rendered something, update the last render index.
+ if ((string) $this->last_render !== '') {
+ $this->last_render_index = $this->view->row_index;
+ }
+
return $this->last_render;
}
...
}
Comment | File | Size | Author |
---|---|---|---|
#5 | views-2994613-5.patch | 1.35 KB | renatog |
|
Comments
Comment #2
MustangGB CreditAttribution: MustangGB commentedThis has been working great for me for the last couple of years, so here's a patch.
Comment #3
DamienMcKennaThanks MustangGB. Let's include it in the next release.
Comment #4
renatogThere are some extra spaces on this line
Comment #5
renatogThe same patch, I'd just updated extra spaces
Comment #6
renatogKeeping the status because the patch's logic is the same
Comment #8
DamienMcKennaCommitted. Thanks!
Comment #9
MustangGB CreditAttribution: MustangGB commentedThanks.