You are here

panopoly_theme.install in Panopoly Theme 7

An installation file for Panopoly Theme

File

panopoly_theme.install
View source
<?php

/**
 * @file
 * An installation file for Panopoly Theme
 */

/**
 * Implementation of hook_install()
 */
function panopoly_theme_install() {
}

/**
 * Implemenetation of hook_uninstall()
 */
function panopoly_theme_uninstall() {
}

/** 
 * Panopoly Beta 6 Update: Updating Location of Panopoly Icons
 */
function panopoly_theme_update_7001(&$sandbox) {

  // Update Bartik, Garland, or Responsive Bartik's Current Logo to New Panopoly Location
  foreach (array(
    'bartik',
    'garland',
    'responsive_bartik',
  ) as $theme_key) {
    $theme_settings = variable_get('theme_' . $theme_key . '_settings');
    if ($theme_settings['logo_path'] == 'profiles/panopoly/images/panopoly_icon_theme.png') {
      $theme_settings['logo_path'] = drupal_get_path('module', 'panopoly_theme') . '/images/panopoly_icon_theme.png';
      variable_set('theme_' . $theme_key . '_settings', $theme_settings);
    }
  }

  // Update Seven's Logo to Go Back to Normal
  $theme_settings = variable_get('theme_seven_settings');
  if ($theme_settings['logo_path'] == 'profiles/panopoly/images/panopoly_icon_install.png') {
    $theme_settings['logo_path'] = '';
    $theme_settings['default_logo'] = 1;
    variable_set('theme_seven_settings', $theme_settings);
  }

  // Flush the Theme Data
  system_rebuild_theme_data();
}

/**
 * Enable radix_layouts and clear layout/theme caches.
 */
function panopoly_theme_update_7002() {
  module_enable(array(
    'radix_layouts',
  ));

  // Clear caches so that we can find the Radix layouts and make the Panopoly
  // layouts stubs.
  cache_clear_all('ctools_plugin_files:panels:layouts', 'cache');
  system_rebuild_theme_data();
}

/**
 * Switch all Panels in the database to use Radix layouts.
 */
function panopoly_theme_update_7003() {
  $panopoly_layouts = array(
    'bartlett',
    'bartlett_flipped',
    'boxton',
    'brenham',
    'brenham_flipped',
    'brown',
    'bryant',
    'bryant_flipped_flipped',
    'burr',
    'burr_flipped',
    'geary',
    'harris',
    'hewston',
    'hewston_flipped',
    'mccoppin',
    'moscone',
    'moscone_flipped',
    'phelan',
    'pond',
    'rolph',
    'sanderson',
    'sanderson_flipped',
    'selby',
    'selby_flipped',
    'sutro',
    'sutro_double',
    'taylor',
    'taylor_flipped',
    'webb',
    'webb_flipped',
    'whelan',
  );
  $results = db_select('panels_display', 'pd')
    ->fields('pd', array(
    'did',
    'layout',
  ))
    ->execute();
  foreach ($results as $display) {
    if (in_array($display->layout, $panopoly_layouts)) {

      // Work around misnamed layout.
      if ($display->layout == 'bryant_flipped_flipped') {
        $display->layout = 'bryant_flipped';
      }
      db_update('panels_display')
        ->fields(array(
        'layout' => 'radix_' . $display->layout,
      ))
        ->condition('did', $display->did)
        ->execute();
    }
  }
}

Functions

Namesort descending Description
panopoly_theme_install Implementation of hook_install()
panopoly_theme_uninstall Implemenetation of hook_uninstall()
panopoly_theme_update_7001 Panopoly Beta 6 Update: Updating Location of Panopoly Icons
panopoly_theme_update_7002 Enable radix_layouts and clear layout/theme caches.
panopoly_theme_update_7003 Switch all Panels in the database to use Radix layouts.