panels_everywhere.install in Panels Everywhere 6
Same filename and directory in other branches
Installation, update and uninstall hooks for Panels Everywhere.
File
panels_everywhere.installView source
<?php
/**
* @file
* Installation, update and uninstall hooks for Panels Everywhere.
*/
/**
* Implements hook_uninstall().
*/
function panels_everywhere_uninstall() {
// Delete the variables.
variable_del('panels_everywhere_head_title_include_name');
variable_del('panels_everywhere_head_title_include_slogan');
variable_del('panels_everywhere_head_title_separator');
variable_del('panels_everywhere_provide_sample');
variable_del('panels_everywhere_site_template_enabled');
variable_del('panels_everywhere_site_template_enabled_admin');
variable_del('panels_everywhere_site_template_per_theme');
foreach (system_theme_data() as $theme) {
variable_del('panels_everywhere_override_theme_' . $theme->name);
}
// Delete the variant(s).
// Steps:
// 1. Query {page_manager_handlers} for any records with 'task' ==
// 'site_template'.
$templates = db_query("SELECT did, conf\n FROM {page_manager_handlers} h\n WHERE task='site_template'");
while ($site_template = db_fetch_object($templates)) {
// 2. Extract the 'conf' field using unserialize(), obtain the 'did' value.
$site_template->conf = unserialize($site_template->conf);
// 3. Delete the display referenced above.
panels_delete_display($site_template->conf['did']);
// 4. Delete the site template record.
db_query("DELETE FROM {page_manager_handlers}\n WHERE task='site_template'\n AND did=%d", array(
$site_template->did,
));
}
drupal_set_message(t('Removed the Panels Everywhere site templates.'));
}
/**
* Implementations of hook_update_N().
*/
/**
* The site_template variants should not use the IPE, so change them to use the
* standard render pipeline.
*/
function panels_everywhere_update_6100() {
$table = 'page_manager_handlers';
$handlers = db_query("SELECT * FROM {" . $table . "} WHERE task = 'site_template'");
$converted = 0;
while ($handler = db_fetch_object($handlers)) {
if (!empty($handler->conf)) {
$handler->conf = unserialize($handler->conf);
if (is_array($handler->conf) && isset($handler->conf['pipeline']) && $handler->conf['pipeline'] == 'ipe') {
$handler->conf['pipeline'] = 'standard';
drupal_write_record($table, $handler, array(
'did',
));
$converted++;
drupal_set_message(t('Converted the @display site template to use the standard renderer.', array(
'@display' => $handler->conf['title'],
)));
}
}
}
if (empty($converted)) {
drupal_set_message(t('No Panels Everywhere displays needed to have their settings updated.'));
}
}
Functions
Name | Description |
---|---|
panels_everywhere_uninstall | Implements hook_uninstall(). |
panels_everywhere_update_6100 | The site_template variants should not use the IPE, so change them to use the standard render pipeline. |