diff --git a/panels.install b/panels.install index dbde82a5cb97fc759715c75f47f604f1d1bc7b9b..6b5f6d183856325175f40fb74657bdbcf585f317 100644 --- a/panels.install +++ b/panels.install @@ -1,6 +1,21 @@ $t('Panels required Chaos Tool Suite (CTools) API Version'), + 'value' => PANELS_REQUIRED_CTOOLS_API, + 'severity' => REQUIREMENT_ERROR, + ); + } + return $requirements; +} + /** * Implementation of hook_schema(). */ diff --git a/panels.module b/panels.module index af8306e78a97057c05edf86e7ac84129a4cd760f..55562a8ad069b1657596b6130321844bee4bbcb3 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 16558ec2c876fa107b8baeadc3455c8dd979b074..6adc7bf3bc357b38b06216c324253ebfd2b3119f 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 671f5bba620272981648a976ff843fd19218532e..18206d6112e3d03750f9f87d3f5ba3589e0108e9 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 db4ed17e45638be87afd18fb77a5f80fbfc598db..d9316101ea72aa8c4c830caaf8c56dd9dfc1be6f 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'),