|
|
@ -578,6 +578,8 @@ function hook_CMODEL_PID_islandora_overview_object_alter(AbstractObject &$object |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Defines derivative functions to be executed based on certain conditions. |
|
|
|
* Defines derivative functions to be executed based on certain conditions. |
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* @param AbstractObject $object |
|
|
|
|
|
|
|
* Object to which derivatives will be added |
|
|
|
* This hook fires when an object/datastream is ingested or a datastream is |
|
|
|
* This hook fires when an object/datastream is ingested or a datastream is |
|
|
|
* modified. |
|
|
|
* modified. |
|
|
|
* |
|
|
|
* |
|
|
@ -611,33 +613,38 @@ function hook_CMODEL_PID_islandora_overview_object_alter(AbstractObject &$object |
|
|
|
* - file: A string denoting the path to the file where the function |
|
|
|
* - file: A string denoting the path to the file where the function |
|
|
|
* is being called from. |
|
|
|
* is being called from. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function hook_islandora_derivative() { |
|
|
|
function hook_islandora_derivative(AbstractObject $object) { |
|
|
|
return array( |
|
|
|
|
|
|
|
array( |
|
|
|
$derivatives[] = array( |
|
|
|
'source_dsid' => 'OBJ', |
|
|
|
'source_dsid' => 'OBJ', |
|
|
|
'destination_dsid' => 'DERIV', |
|
|
|
'destination_dsid' => 'DERIV', |
|
|
|
'weight' => '0', |
|
|
|
'weight' => '0', |
|
|
|
'function' => array( |
|
|
|
'function' => array( |
|
|
|
'islandora_derivatives_test_create_deriv_datastream', |
|
|
|
'islandora_derivatives_test_create_deriv_datastream', |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
array( |
|
|
|
); |
|
|
|
|
|
|
|
// Test object before adding this derivative. |
|
|
|
|
|
|
|
if ($object['SOMEWEIRDDATASTREAM']->mimetype == "SOMETHING/ODD") { |
|
|
|
|
|
|
|
$derivatives[] = array( |
|
|
|
'source_dsid' => 'SOMEWEIRDDATASTREAM', |
|
|
|
'source_dsid' => 'SOMEWEIRDDATASTREAM', |
|
|
|
'destination_dsid' => 'STANLEY', |
|
|
|
'destination_dsid' => 'STANLEY', |
|
|
|
'weight' => '-1', |
|
|
|
'weight' => '-1', |
|
|
|
'function' => array( |
|
|
|
'function' => array( |
|
|
|
'islandora_derivatives_test_create_some_weird_datastream', |
|
|
|
'islandora_derivatives_test_create_some_weird_datastream', |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
array( |
|
|
|
} |
|
|
|
'source_dsid' => NULL, |
|
|
|
|
|
|
|
'destination_dsid' => 'NOSOURCE', |
|
|
|
$derivatives[] = array( |
|
|
|
'weight' => '-3', |
|
|
|
'source_dsid' => NULL, |
|
|
|
'function' => array( |
|
|
|
'destination_dsid' => 'NOSOURCE', |
|
|
|
'islandora_derivatives_test_create_nosource_datastream', |
|
|
|
'weight' => '-3', |
|
|
|
), |
|
|
|
'function' => array( |
|
|
|
|
|
|
|
'islandora_derivatives_test_create_nosource_datastream', |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $derivatives; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|