Permalink
Browse files

HTML functionality added.

  • Loading branch information...
1 parent 9600804 commit 0532735db4141e410dcb193d20fe106bfdd1af14 @andrew-wolfe andrew-wolfe committed Aug 21, 2012
Showing with 27 additions and 14 deletions.
  1. +15 −6 digital_strategy.install
  2. +12 −8 digital_strategy.module
@@ -9,20 +9,24 @@
* Implementation of hook_install().
*/
function digital_strategy_install() {
- variable_set('digital_strategy_types', array("xml", "json", "jsonp"));
+ 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"));
+ variable_set('digital_strategy_types', array("xml", "json", "jsonp", "html"));
digital_strategy_create_nodes();
}
// On module disable delete nodes and digital strategy type variables
function digital_strategy_disable() {
- foreach (variable_get('digital_strategy_types', array("xml", "json", "jsonp")) as $type) {
+ foreach (variable_get('digital_strategy_types', array("xml", "json", "jsonp", "html")) as $type) {
$alias = "digitalstrategy/" . $type;
+ // to delete the html page alias will be digitalstrategy/report
+ if ($type == 'html') {
+ $alias = "digitalstrategy/report";
+ }
$path = drupal_lookup_path("source", $alias);
$node = menu_get_object("node", 1, $path);
@@ -33,12 +37,13 @@ function digital_strategy_disable() {
drupal_set_message(t('@alias not deleted, it did not exist.', array('@alias' => $alias)), 'warning');
}
}
- variable_del('strategy_types');
+
+ variable_del('digital_strategy_types');
}
// Creates the nodes for the digital strategy type variables
function digital_strategy_create_nodes() {
- foreach (variable_get('digital_strategy_types', array("xml", "json", "jsonp")) as $type) {
+ foreach (variable_get('digital_strategy_types', array("xml", "json", "jsonp", "html")) as $type) {
$node = new stdClass();
$node->name = "Digital Strategy Progess - " . $type;
$node->title = $node->name;
@@ -52,7 +57,11 @@ function digital_strategy_create_nodes() {
$node->format = 2;
$node->apachesolr_exclude = 1;
$node->pathauto_perform_alias = 0;
- $node->path = "digitalstrategy/" . $type;
+ $node->path = "digitalstrategy/" . $type;
+ // change the path for the html version
+ if ($type == 'html') {
+ $node->path = "digitalstrategy/report";
+ }
if ($node = node_submit($node)) {
node_save($node);
@@ -12,15 +12,19 @@ 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")) as $type) {
- $items['digitalstrategy.' . $type] = array(
- 'access arguments' => array('access content'),
- 'page callback' => '_digital_strategy_themeless',
- 'page arguments' => array($type),
- 'title' => $type,
- 'type' => MENU_CALLBACK,
- );
+ foreach (variable_get('digital_strategy_types', array("xml", "json", "jsonp", "html")) as $type) {
+ // create callback menu item for everything except html
+ if ($type != 'html') {
+ $items['digitalstrategy.' . $type] = array(
+ 'access arguments' => array('access content'),
+ 'page callback' => '_digital_strategy_themeless',
+ 'page arguments' => array($type),
+ 'title' => $type,
+ 'type' => MENU_CALLBACK,
+ );
+ }
} // end foreach
+
return $items;
}

0 comments on commit 0532735

Please sign in to comment.