A very large amount of the time when creating a style plugin that is a child of another style plugin, you will want to use the same theme function.

However, when you declare 'theme' => 'name' in the hook_views_plugins, it unconditionally tries to register that theme function as though you own it. This can mess up that theme function's definition completely. We need a way to prevent this from happening. The easiest way is probably a flag, but there might also be something we can do with tracing the parent trees. Since the most common occurence is on parentage, we can test any and all parent plugins and if they're using the same theme function, don't register it.

We can also test to see if a theme function is already registered as well, but that could lead to ordering issues where the correct one is actually registered last.

This bug goes all the way back to Views 2.x

CommentFileSizeAuthor
#3 1205376-register.patch587 bytesdawehner
#2 1205376-register.patch554 bytesdawehner

Comments

dww’s picture

Yeah, this nailed me over at #1170264: Add a views row style plugin to render panelizer nodes. For now, the workaround Earl suggested (which is working) is to do this in the plugin's init() method:

    $this->definition['theme'] = 'views_view_row_node';
dawehner’s picture

Status: Active » Needs review
StatusFileSize
new554 bytes

Here is a patch.

dawehner’s picture

StatusFileSize
new587 bytes

With a slighly better name

dawehner’s picture

Status: Needs review » Fixed

Commited to 7.x-3.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.