Browse Source

Merge pull request #673 from DiegoPino/7.x-ISLANDORA-1960

ISLANDORA-1960 Allow NULL abstract object in derivative alter hook
pull/674/head
Rosemary Le Faive 8 years ago committed by GitHub
parent
commit
83a0781e70
  1. 2
      islandora.api.php
  2. 2
      tests/islandora_derivatives_test.module

2
islandora.api.php

@ -746,7 +746,7 @@ function hook_cmodel_pid_islandora_derivative() {
/** /**
* Allows for the altering of defined derivative functions. * Allows for the altering of defined derivative functions.
*/ */
function hook_islandora_derivative_alter(&$derivatives, AbstractObject $object, $ds_modified_params = array()) { function hook_islandora_derivative_alter(&$derivatives, AbstractObject $object = NULL, $ds_modified_params = array()) {
foreach ($derivatives as $key => $derivative) { foreach ($derivatives as $key => $derivative) {
if ($derivative['destination_dsid'] == 'TN') { if ($derivative['destination_dsid'] == 'TN') {
unset($derivatives[$key]); unset($derivatives[$key]);

2
tests/islandora_derivatives_test.module

@ -48,7 +48,7 @@ function islandora_derivatives_test_some_cmodel_islandora_derivative() {
/** /**
* Implements hook_islandora_CMODEL_PID_derivative_alter(). * Implements hook_islandora_CMODEL_PID_derivative_alter().
*/ */
function islandora_derivatives_test_some_cmodel_islandora_derivative_alter(&$derivatives, AbstractObject $object, $ds_modified_params) { function islandora_derivatives_test_some_cmodel_islandora_derivative_alter(&$derivatives, AbstractObject $object = NULL, $ds_modified_params = array()) {
// Use a mask to determine if only the label has been modified. // Use a mask to determine if only the label has been modified.
$diff = array_diff_key($ds_modified_params, array( $diff = array_diff_key($ds_modified_params, array(
'label' => NULL, 'label' => NULL,

Loading…
Cancel
Save