We have created a custom installation profile in which we enable the Breakpoints module and our custom theme. The custom theme is enabled by calling theme_enable() in an implementation of hook_install() like this:

<?php
function myprofile_install() {
 
theme_enable(array('my_theme'));
}
?>

The problem we are encountering is that although the theme is enabled, the call to theme_enable() doesn't cause Breakpoints to load the breakpoint settings from the theme's .info file and store them in the breakpoints database table.

mysql> select name, status from system where type = 'theme' and name = 'my_theme';
+----------+--------+
| name     | status |
+----------+--------+
| my_theme |      1 |
+----------+--------+

mysql> select * from breakpoints;
Empty set (0.11 sec)

I will follow up with a proposed solution, but other suggestions are certainly welcome.

Files: 
CommentFileSizeAuthor
#1 breakpoints-installation_enable_theme-1993976-1.patch900 bytesjlapp
Test request sent.
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new900 bytes
Test request sent.
[ View ]

I did some debugging and found that when theme_enable() calls Breakpoints' breakpoints_themes_enabled(), $themes[$theme_key]->status returns 0 for the theme that was just enabled. This is because during installation the site is in maintenance mode and so list_themes() does not load the theme's status field from the database.

It seems like the check for whether a theme is enabled before importing breakpoints would be better done in breakpoints_enable() instead of breakpoints_themes_enabled(). breakpoints_enable() looks at all themes and should call breakpoints_themes_enabled() only for enabled themes, whereas breakpoints_themes_enabled() should assume that any themes passed to it are enabled.

I've attached a patch against 7.x-1.x-dev for the change I described. This fixes the issue I encountered when enabling themes in an installation profile, but should not have any further impact on existing behavior.

Status:Needs review» Fixed

Thanks

Status:Fixed» Closed (fixed)

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