Browse Source

Coding standards

7.x-2.x
Daniel Lamb 9 years ago
parent
commit
b7d2a0e047
  1. 16
      islandora_basic_image/islandora_basic_image.module
  2. 12
      islandora_collection/islandora_collection.module
  3. 2
      islandora_medium_size_service/include/islandora_medium_size_service.inc
  4. 12
      islandora_tn_service/include/islandora_tn_service.inc

16
islandora_basic_image/islandora_basic_image.module

@ -71,7 +71,15 @@ function islandora_basic_image_form_islandora_basic_image_node_form_alter(&$form
} }
} }
function islandora_basic_image_add_parent_uuid($form, &$form_state) { /**
* Custom submit handler to pass along parent uuid.
*
* @param array $form
* Drupal form.
* @param array $form_state
* Drupal form state.
*/
function islandora_basic_image_add_parent_uuid(array $form, array &$form_state) {
$node = $form_state['node']; $node = $form_state['node'];
$node->parent_collection = ""; $node->parent_collection = "";
if (isset($form_state['parent_collection']['#value'])) { if (isset($form_state['parent_collection']['#value'])) {
@ -91,6 +99,9 @@ function islandora_basic_image_rdf_mapping() {
return islandora_get_default_rdf_mapping(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE, $rdf_types); return islandora_get_default_rdf_mapping(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE, $rdf_types);
} }
/**
* Implements hook_node_postinsert().
*/
function islandora_basic_image_node_postinsert($node) { function islandora_basic_image_node_postinsert($node) {
if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) { if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) {
return; return;
@ -136,6 +147,9 @@ function islandora_basic_image_node_postinsert($node) {
$response = httprl_send_request(); $response = httprl_send_request();
} }
/**
* Implements hook_node_postupdate().
*/
function islandora_basic_image_node_postupdate($node) { function islandora_basic_image_node_postupdate($node) {
if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) { if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) {
return; return;

12
islandora_collection/islandora_collection.module

@ -74,7 +74,15 @@ function islandora_collection_form_islandora_collection_node_form_alter(&$form,
} }
} }
function islandora_collection_add_parent_uuid($form, &$form_state) { /**
* Custom submit handler to pass along parent uuid.
*
* @param array $form
* Drupal form.
* @param array $form_state
* Drupal form state.
*/
function islandora_collection_add_parent_uuid(array $form, array &$form_state) {
$node = $form_state['node']; $node = $form_state['node'];
$node->parent_collection = ""; $node->parent_collection = "";
if (isset($form_state['parent_collection']['#value'])) { if (isset($form_state['parent_collection']['#value'])) {
@ -108,7 +116,6 @@ function islandora_collection_node_postinsert($node) {
} }
$parent_collection = $node->parent_collection; $parent_collection = $node->parent_collection;
dd("PARENT UUID: $parent_collection");
$nodes = entity_uuid_load('node', array($node->uuid)); $nodes = entity_uuid_load('node', array($node->uuid));
// Exit early if the node never was successfully inserted in the database. // Exit early if the node never was successfully inserted in the database.
@ -118,7 +125,6 @@ function islandora_collection_node_postinsert($node) {
$node = array_pop($nodes); $node = array_pop($nodes);
$url = "http://127.0.0.1:8181/islandora/rest/collection/$parent_collection"; $url = "http://127.0.0.1:8181/islandora/rest/collection/$parent_collection";
dd("REQUEST URL: $url");
// Don't forget the trailing slash. // Don't forget the trailing slash.
httprl_request($url, httprl_request($url,

2
islandora_medium_size_service/include/islandora_medium_size_service.inc

@ -14,7 +14,7 @@
* @return string * @return string
* Response message. * Response message.
*/ */
function islandora_medium_size_service_create($args) { function islandora_medium_size_service_create(array $args) {
$uuid = $args['uuid']; $uuid = $args['uuid'];
$tn_b64 = $args['file']; $tn_b64 = $args['file'];
$mimetype = $args['mimetype']; $mimetype = $args['mimetype'];

12
islandora_tn_service/include/islandora_tn_service.inc

@ -8,15 +8,13 @@
/** /**
* The POST callback for the TN service. * The POST callback for the TN service.
* *
* @param string $type * @param array $args
* Entity type to which the RDF mapping belongs. * JSON decoded function arguments.
* @param string $bundle
* Bundle to which the RDF mapping belongs.
* *
* @return array * @return string
* The RDF mapping. * Message.
*/ */
function islandora_tn_service_create($args) { function islandora_tn_service_create(array $args) {
$uuid = $args['uuid']; $uuid = $args['uuid'];
$tn_b64 = $args['file']; $tn_b64 = $args['file'];
$mimetype = $args['mimetype']; $mimetype = $args['mimetype'];

Loading…
Cancel
Save