Browse Source

Coding standards

7.x-2.x
Daniel Lamb 10 years ago
parent
commit
b7d2a0e047
  1. 16
      islandora_basic_image/islandora_basic_image.module
  2. 12
      islandora_collection/islandora_collection.module
  3. 4
      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->parent_collection = "";
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);
}
/**
* Implements hook_node_postinsert().
*/
function islandora_basic_image_node_postinsert($node) {
if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) {
return;
@ -136,6 +147,9 @@ function islandora_basic_image_node_postinsert($node) {
$response = httprl_send_request();
}
/**
* Implements hook_node_postupdate().
*/
function islandora_basic_image_node_postupdate($node) {
if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) {
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->parent_collection = "";
if (isset($form_state['parent_collection']['#value'])) {
@ -108,7 +116,6 @@ function islandora_collection_node_postinsert($node) {
}
$parent_collection = $node->parent_collection;
dd("PARENT UUID: $parent_collection");
$nodes = entity_uuid_load('node', array($node->uuid));
// 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);
$url = "http://127.0.0.1:8181/islandora/rest/collection/$parent_collection";
dd("REQUEST URL: $url");
// Don't forget the trailing slash.
httprl_request($url,

4
islandora_medium_size_service/include/islandora_medium_size_service.inc

@ -14,7 +14,7 @@
* @return string
* Response message.
*/
function islandora_medium_size_service_create($args) {
function islandora_medium_size_service_create(array $args) {
$uuid = $args['uuid'];
$tn_b64 = $args['file'];
$mimetype = $args['mimetype'];
@ -36,7 +36,7 @@ function islandora_medium_size_service_create($args) {
'alt' => "Medium sized image for node $uuid",
'title' => "Medium sized image for node $uuid",
);
$node->field_tn[LANGUAGE_NONE][] = array(
$node->field_tn[LANGUAGE_NONE][] = array(
'fid' => $file->fid,
'width' => 100,
'height' => 100,

12
islandora_tn_service/include/islandora_tn_service.inc

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

Loading…
Cancel
Save