summaryrefslogtreecommitdiffstats
path: root/zen
diff options
context:
space:
mode:
authorJohnAlbin2008-09-15 09:59:03 +0000
committerJohnAlbin2008-09-15 09:59:03 +0000
commit89804871d1d5a9445eb86f94becd7a5d764e669d (patch)
tree8d61b10b719dd2c40a9711e6fa20e5192d45aafc /zen
parenta716ef8d17f056d22af464a18bd72020c7cd0714 (diff)
#307309: Add feature to rebuild theme registry during theme development
Diffstat (limited to 'zen')
-rw-r--r--zen/template.php5
-rw-r--r--zen/template.theme-registry.inc5
-rw-r--r--zen/theme-settings.css4
-rw-r--r--zen/theme-settings.php11
-rw-r--r--zen/zen.info1
5 files changed, 23 insertions, 3 deletions
diff --git a/zen/template.php b/zen/template.php
index 7b02fe7..c4697dc 100644
--- a/zen/template.php
+++ b/zen/template.php
@@ -13,6 +13,10 @@
* http://drupal.org/node/193318
*/
+// Auto-rebuild the theme registry during theme development.
+if (theme_get_setting('zen_rebuild_registry')) {
+ drupal_rebuild_theme_registry();
+}
/*
* Add stylesheets only needed when Zen is the active theme. Don't do something
@@ -27,7 +31,6 @@ if ($GLOBALS['theme'] == 'zen') { // If we're in the main theme
}
}
-
/**
* Implements HOOK_theme().
*/
diff --git a/zen/template.theme-registry.inc b/zen/template.theme-registry.inc
index 7bab165..0cf2091 100644
--- a/zen/template.theme-registry.inc
+++ b/zen/template.theme-registry.inc
@@ -58,6 +58,11 @@ function _zen_theme(&$existing, $type, $theme, $path) {
// values may have changed, make sure they are saved in the database properly.
zen_theme_get_default_settings($theme);
+ // If we are auto-rebuilding the theme registry, warn about feature.
+ if (theme_get_setting('zen_rebuild_registry')) {
+ drupal_set_message(t('The theme registry has been rebuilt. <a href="!link">Turn off</a> this feature on production websites.', array('!link' => base_path() . 'admin/build/themes/settings/' . $GLOBALS['theme'])), 'warning');
+ }
+
// Since we modify the $existing cache directly, return nothing.
return array();
}
diff --git a/zen/theme-settings.css b/zen/theme-settings.css
index 4112ab0..fa1b36a 100644
--- a/zen/theme-settings.css
+++ b/zen/theme-settings.css
@@ -37,11 +37,13 @@
text-align: left;
}
+ #div-zen-registry,
#div-zen-wireframes
{
margin: 1em 0;
}
+ #div-zen-registry strong,
#div-zen-wireframes strong
{
float: left;
@@ -51,6 +53,7 @@
text-align: right;
}
+ #div-zen-registry fieldset .form-item,
#div-zen-wireframes fieldset .form-item
{
display: inline;
@@ -58,6 +61,7 @@
padding-left: 0;
}
+ #div-zen-registry fieldset .form-item .description,
#div-zen-wireframes fieldset .form-item .description
{
display: block;
diff --git a/zen/theme-settings.php b/zen/theme-settings.php
index 72af053..7601cea 100644
--- a/zen/theme-settings.php
+++ b/zen/theme-settings.php
@@ -94,7 +94,14 @@ function zen_settings($saved_settings, $subtheme_defaults = array()) {
'#title' => t('Theme development settings'),
'#attributes' => array('id' => 'zen-themedev'),
);
- // drupal_rebuild_theme_registry()
+ $form['themedev']['zen_rebuild_registry'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Rebuild theme registry on every page.'),
+ '#default_value' => $settings['zen_rebuild_registry'],
+ '#description' => t('During theme development, it can be very useful to continuously <a href="!link">rebuild the theme registry</a>. WARNING: this is a huge performance penalty and must be turned off on production websites.', array('!link' => 'http://drupal.org/node/173880#theme-registry')),
+ '#prefix' => '<div id="div-zen-registry"><strong>' . t('Theme registry:') . '</strong>',
+ '#suffix' => '</div>',
+ );
$form['themedev']['zen_layout'] = array(
'#type' => 'radios',
'#title' => t('Layout method'),
@@ -108,7 +115,7 @@ function zen_settings($saved_settings, $subtheme_defaults = array()) {
'#type' => 'checkbox',
'#title' => t('Display borders around main layout elements'),
'#default_value' => $settings['zen_wireframes'],
- '#description' => l(t('Wireframes'), 'http://www.boxesandarrows.com/view/html_wireframes_and_prototypes_all_gain_and_no_pain') . t(' are useful when prototyping a website.'),
+ '#description' => t('<a href="!link">Wireframes</a> are useful when prototyping a website.', array('!link' => 'http://www.boxesandarrows.com/view/html_wireframes_and_prototypes_all_gain_and_no_pain')),
'#prefix' => '<div id="div-zen-wireframes"><strong>' . t('Wireframes:') . '</strong>',
'#suffix' => '</div>',
);
diff --git a/zen/zen.info b/zen/zen.info
index c1934b3..bdf3425 100644
--- a/zen/zen.info
+++ b/zen/zen.info
@@ -78,4 +78,5 @@ settings[zen_breadcrumb_home] = 1
settings[zen_breadcrumb_trailing] = 1
settings[zen_breadcrumb_title] = 0
settings[zen_layout] = border-politics-liquid
+settings[zen_rebuild_registry] = 0
settings[zen_wireframes] = 0