Problem/Motivation

When trying to add Panelizer handlers for new entity types it hit errors when registering my class as the Base class was not in registry so couldn't be loaded.

Solution

Add the PanelizerEntityxyz classes to the registry by adding them to the .info file.

CommentFileSizeAuthor
#1 1982454-1.patch634 bytesrlmumford
panelizer_update.patch577 bytesrlmumford

Comments

rlmumford’s picture

StatusFileSize
new634 bytes

Here's another patch, made directly against head. The last one failed to apply for some reason.

merlinofchaos’s picture

Status: Needs review » Closed (won't fix)

No, these are CTools plugins. CTools automatically registers plugin classes via hook_registry_alter(). There is no need to put these files in the .info.

merlinofchaos’s picture

Also, without applying your patch:

mysql> select name, type from registry where module = 'panelizer';
+-------------------------------------------+-----------+
| name                                      | type      |
+-------------------------------------------+-----------+
| PanelizerEntityDefault                    | class     |
| PanelizerEntityNode                       | class     |
| PanelizerEntityTaxonomyTerm               | class     |
| PanelizerEntityUser                       | class     |
| panelizer_defaults_ui                     | class     |
| panelizer_handler_field_link              | class     |
| panelizer_handler_filter_panelizer_status | class     |
| panelizer_handler_panelizer_status        | class     |
| panelizer_plugin_row_panelizer_node_view  | class     |
| PanelizerEntityInterface                  | interface |
+-------------------------------------------+-----------+
10 rows in set (0.14 sec)

So if those don't appear in your registry, something else is wrong.

merlinofchaos’s picture

Issue summary: View changes

Updated issue summary.

andrewbelcher’s picture

Category: Bug report » Support request
Issue summary: View changes
Status: Closed (won't fix) » Active

Sorry to re-open this - we are still having an issue with this.

I think when building the registry it attempts to add our class before it adds the ones provided by Panelizer and then throws the error as the class being extended isn't yet registered. I'm guessing this is due to our modules beginning with c and f, which means it gets processed before Panelizer?

Is there a solution to that other than messing with module weights?

mglaman’s picture

Status: Active » Closed (won't fix)

andrewbelcher, a solution is to use hook_implements_alter() to ensure your module runs hook_ctools_plugin_directory() last.

Unfortunately there isn't much of a way to work around this (modules and alphabetical sorting) unless you modify the system weight or implementation alters.

Putting back to the original won't fix status, as defining the classes in the .info would go against the ctools plugin implementation, stated in #2

Somewhat relevant issue on topic of module naming weight - #2183937: Error on install of Panopoly-based install profile: "Column 'module' cannot be null" when profile starts with "e"