Browse files

Added checks for apachesolr_exclude and pathauto modules.

  • Loading branch information...
1 parent 0532735 commit c98eba4fb5e69c4e97c376d4f96d2185f3069d0e @andrew-wolfe andrew-wolfe committed Aug 28, 2012
Showing with 15 additions and 18 deletions.
  1. +1 −1 digital_strategy.info
  2. +12 −14 digital_strategy.install
  3. +2 −3 digital_strategy.module
View
2 digital_strategy.info
@@ -1,6 +1,6 @@
name = Digital Strategy
-description = Creates 3 page nodes for digital strategy progess on enable. Also creates menu callbacks which load the page nodes and output just the body with the appropriate content type headers.
+description = Creates page nodes for each of the digital strategy progress types on enable. Also creates menu callbacks which load the page nodes and output just the body with the appropriate content type headers for specific strategy types.
core = 6.x
package = Digital Strategy
dependencies[] = path
View
26 digital_strategy.install
@@ -5,14 +5,6 @@
* Install file for Digital Strategy module.
*/
-/**
- * Implementation of hook_install().
- */
-function digital_strategy_install() {
- variable_set('digital_strategy_types', array("xml", "json", "jsonp", "html"));
- digital_strategy_create_nodes();
-}
-
// On module enable create nodes and set digital strategy type variables
function digital_strategy_enable() {
variable_set('digital_strategy_types', array("xml", "json", "jsonp", "html"));
@@ -27,7 +19,7 @@ function digital_strategy_disable() {
if ($type == 'html') {
$alias = "digitalstrategy/report";
}
- $path = drupal_lookup_path("source", $alias);
+ $path = drupal_lookup_path("source", $alias);
$node = menu_get_object("node", 1, $path);
if ($node) {
@@ -37,8 +29,7 @@ function digital_strategy_disable() {
drupal_set_message(t('@alias not deleted, it did not exist.', array('@alias' => $alias)), 'warning');
}
}
-
- variable_del('digital_strategy_types');
+ variable_del('strategy_types');
}
// Creates the nodes for the digital strategy type variables
@@ -55,12 +46,19 @@ function digital_strategy_create_nodes() {
$node->promote = 0;
$node->sticky = 0;
$node->format = 2;
- $node->apachesolr_exclude = 1;
- $node->pathauto_perform_alias = 0;
- $node->path = "digitalstrategy/" . $type;
+ if (module_exists("pathauto")) {
+ $node->pathauto_perform_alias = 0;
+ }
+ if (module_exists("apachesolr_exclude")) {
+ $node->apachesolr_exclude = 1;
+ }
+ $node->path = "digitalstrategy/" . $type;
// change the path for the html version
if ($type == 'html') {
$node->path = "digitalstrategy/report";
+ if (module_exists("apachesolr_exclude")) {
+ $node->apachesolr_exclude = 0;
+ }
}
if ($node = node_submit($node)) {
View
5 digital_strategy.module
@@ -11,8 +11,8 @@
function digital_strategy_menu() {
$items = array();
- // Loops through the digital strategy type variables to create menu callbacks for each type
- foreach (variable_get('digital_strategy_types', array("xml", "json", "jsonp", "html")) as $type) {
+ // Loops through the digital strategy type variables to create menu callbacks for each type
+ foreach (variable_get('digital_strategy_types', array("xml", "json", "jsonp")) as $type) {
// create callback menu item for everything except html
if ($type != 'html') {
$items['digitalstrategy.' . $type] = array(
@@ -24,7 +24,6 @@ function digital_strategy_menu() {
);
}
} // end foreach
-
return $items;
}

0 comments on commit c98eba4

Please sign in to comment.