summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2009-05-05 22:14:29 (GMT)
committer Earl Miles2009-05-05 22:14:29 (GMT)
commitee0e6fa905e6b24d3a0d3a88d6a09aa2dc28e9ec (patch)
tree07a17a38c8e4283a0dc08b1e75a85f792e0e0d34
parent02f15c7cca6040cf92f5e0ac526882cb5e592cfc (diff)
Update to require CTools based upon its advertised API version number.
-rw-r--r--panels.install15
-rw-r--r--panels.module21
-rw-r--r--panels_export/panels_export.module10
-rw-r--r--panels_mini/panels_mini.module7
-rw-r--r--panels_node/panels_node.module10
5 files changed, 54 insertions, 9 deletions
diff --git a/panels.install b/panels.install
index dbde82a..6b5f6d1 100644
--- a/panels.install
+++ b/panels.install
@@ -2,6 +2,21 @@
// $Id$
/**
+ * Test requirements for installation and running.
+ */
+function panels_requirements($phase) {
+ $requirements = array();
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
+ $requirements['panels_ctools'] = array(
+ 'title' => $t('Panels required Chaos Tool Suite (CTools) API Version'),
+ 'value' => PANELS_REQUIRED_CTOOLS_API,
+ 'severity' => REQUIREMENT_ERROR,
+ );
+ }
+ return $requirements;
+}
+
+/**
* Implementation of hook_schema().
*/
function panels_schema() {
diff --git a/panels.module b/panels.module
index af8306e..55562a8 100644
--- a/panels.module
+++ b/panels.module
@@ -7,6 +7,8 @@
* Core functionality for the Panels engine.
*/
+define('PANELS_REQUIRED_CTOOLS_API', '1.0');
+
/**
* Returns the API version of Panels. This didn't exist in 1.
*
@@ -20,9 +22,8 @@ function panels_api_version() {
* Implementation of hook_theme()
*/
function panels_theme() {
- // Safety: Make sure update.php can still run when panels is updated but
- // ctools wasn't there, as Panels 2 did not have this dependency:
- if (!module_exists('ctools')) {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
return array();
}
@@ -77,7 +78,7 @@ function panels_theme() {
'file' => '../includes/callbacks.inc',
'template' => 'panels-dashboard',
);
-
+
// Register layout and style themes on behalf of all of these items.
panels_load_include('plugins');
@@ -131,9 +132,8 @@ function panels_theme() {
* Implementation of hook_menu
*/
function panels_menu() {
- // Safety: Make sure update.php can still run when panels is updated but
- // ctools wasn't there, as Panels 2 did not have this dependency:
- if (!module_exists('ctools')) {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
return array();
}
$items = array();
@@ -259,6 +259,11 @@ function panels_menu() {
* Implementation of hook_init()
*/
function panels_init() {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
+ return;
+ }
+
drupal_add_css(panels_get_path('css/panels.css'));
drupal_add_js(panels_get_path('js/panels.js'));
}
@@ -962,7 +967,7 @@ function panels_ctools_plugin_styles() {
/**
* Get the display that is currently being rendered as a page.
- *
+ *
* Unlike in previous versions of this, this only returns the display,
* not the page itself, because there are a number of different ways
* to get to this point. It is hoped that the page data isn't needed
diff --git a/panels_export/panels_export.module b/panels_export/panels_export.module
index 16558ec..6adc7bf 100644
--- a/panels_export/panels_export.module
+++ b/panels_export/panels_export.module
@@ -12,6 +12,11 @@
* Implementation of hook_menu().
*/
function panels_export_menu() {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
+ return array();
+ }
+
$items = array();
$items['admin/build/panels/export'] = array(
'title' => 'Bulk export',
@@ -32,6 +37,11 @@ function panels_export_menu() {
* Implementation of hook_theme()
*/
function panels_export_theme() {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
+ return array();
+ }
+
return array(
'panels_export_export_form' => array(
'arguments' => array('form' => NULL),
diff --git a/panels_mini/panels_mini.module b/panels_mini/panels_mini.module
index 671f5bb..18206d6 100644
--- a/panels_mini/panels_mini.module
+++ b/panels_mini/panels_mini.module
@@ -19,6 +19,10 @@ function panels_mini_perm() {
* Implementation of hook_menu().
*/
function panels_mini_menu() {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
+ return array();
+ }
require_once drupal_get_path('module', 'panels_mini') . '/panels_mini.admin.inc';
return _panels_mini_menu();
}
@@ -32,7 +36,8 @@ function panels_mini_menu() {
* Expose qualifying mini panels to Drupal's block system.
*/
function panels_mini_block($op = 'list', $delta = 0, $edit = array()) {
- if (!module_exists('ctools')) {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
return array();
}
diff --git a/panels_node/panels_node.module b/panels_node/panels_node.module
index db4ed17..d931610 100644
--- a/panels_node/panels_node.module
+++ b/panels_node/panels_node.module
@@ -24,6 +24,11 @@ function panels_node_perm() {
* Implementation of hook_menu().
*/
function panels_node_menu() {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
+ return array();
+ }
+
$items['admin/build/panels/settings/panel-node'] = array(
'title' => 'Panel nodes',
'description' => 'Configure which content is available to add to panel node displays.',
@@ -78,6 +83,11 @@ function panels_node_edit_node($node) {
* Implementation of hook_node_info().
*/
function panels_node_node_info() {
+ // Safety: go away if CTools is not at an appropriate version.
+ if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
+ return array();
+ }
+
return array(
'panel' => array(
'name' => t('Panel'),