diff --git a/islandora/islandora.module b/islandora/islandora.module index 2dba98fa..75d3a0c4 100644 --- a/islandora/islandora.module +++ b/islandora/islandora.module @@ -52,6 +52,17 @@ function islandora_rdf_namespaces() { ); } +/** + * Implements hook_entity_load(). + */ +function islandora_entity_load($entities, $type) { + foreach ($entities as $entity) { + if (strcmp($type, "node") == 0) { + $entity->rdf_namespaces = rdf_get_namespaces(); + } + } +} + /** * Implements hook_default_services_endpoint(). */ diff --git a/islandora_collection/islandora_collection.info b/islandora_collection/islandora_collection.info index a2a6503a..5efc2e69 100644 --- a/islandora_collection/islandora_collection.info +++ b/islandora_collection/islandora_collection.info @@ -5,3 +5,4 @@ version = 7.x-dev core = 7.x dependencies[] = islandora dependencies[] = hook_post_action +dependencies[] = httprl diff --git a/islandora_collection/islandora_collection.module b/islandora_collection/islandora_collection.module index b1d77fdd..1401291c 100644 --- a/islandora_collection/islandora_collection.module +++ b/islandora_collection/islandora_collection.module @@ -54,6 +54,11 @@ function islandora_collection_rdf_mapping() { * Implements hook_node_postinsert(). */ function islandora_collection_node_postinsert($node) { + if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) { + dd("IGNORING HOOK!"); + return; + } + // Exit early if it's not a collection. if (strcmp($node->type, ISLANDORA_COLLECTION_CONTENT_TYPE) != 0) { return; @@ -67,7 +72,6 @@ function islandora_collection_node_postinsert($node) { } $node = array_pop($nodes); - $node->rdf_namespaces = rdf_get_namespaces(); httprl_request("http://localhost:8080/islandora-services/rest/collection", array( 'method' => 'POST', @@ -82,4 +86,8 @@ function islandora_collection_node_postinsert($node) { */ function islandora_collection_node_postupdate($node) { dd("FROM POST UPDATE HOOK"); + if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) { + dd("IGNORING HOOK!"); + return; + } }