Browse Source

Merge pull request #471 from willtp87/7.x.rules

rules integration during ingest
pull/474/head
Nigel Banks 11 years ago
parent
commit
5c3dacbfe6
  1. 4
      includes/tuque_wrapper.inc
  2. 5
      islandora.module
  3. 23
      islandora.rules.inc
  4. 26
      islandora.rules_defaults.inc

4
includes/tuque_wrapper.inc

@ -115,6 +115,10 @@ class IslandoraFedoraRepository extends FedoraRepository {
foreach ($object as $dsid => $datastream) {
islandora_invoke_datastream_hooks(ISLANDORA_DATASTREAM_INGESTED_HOOK, $object->models, $dsid, $object, $datastream);
}
// Fire of event if rules is enabled.
if (module_exists('rules')) {
rules_invoke_event('islandora_object_ingested', $object);
}
return $ret;
}
catch (Exception $e) {

5
islandora.module

@ -1531,6 +1531,11 @@ function islandora_entity_property_info() {
'label' => t('Content Models'),
'description' => t('The list of content models which the object has.'),
);
$p['createdDate'] = array(
'type' => 'text',
'label' => t('Created Date'),
'description' => t('When the object was created.'),
);
return $info;
}

23
islandora.rules.inc

@ -5,11 +5,30 @@
* Does rule type stuff,
*/
/**
* Implements hook_rules_event_info().
*/
function islandora_rules_event_info() {
return array(
'islandora_object_ingested' => array(
'group' => t('Islandora'),
'label' => t('Object ingested'),
'variables' => array(
'object' => array(
'type' => 'islandora_object',
'label' => t('The ingested object'),
'description' => t('A Tuque object for the ingested Fedora object, as an entity.'),
),
),
),
);
}
/**
* Helper function to get reused "parameter" array.
*/
function islandora_rules_relationship_parameter_array() {
$to_return = array(
return array(
'subject' => array(
'type' => 'islandora_object',
'label' => t('Subject'),
@ -39,8 +58,6 @@ function islandora_rules_relationship_parameter_array() {
'default value' => 0,
),
);
return $to_return;
}
/**

26
islandora.rules_defaults.inc

@ -0,0 +1,26 @@
<?php
/**
* @file
* Implementation of Rules hooks, giving default configurations.
*/
/**
* Implements hook_default_rules_configuration().
*/
function islandora_default_rules_configuration() {
$rule = rules_reaction_rule();
$rule->label = 'E-mail admin';
$rule->active = FALSE;
$rule
->event('islandora_object_ingested')
->action(
'mail',
array(
'to' => '[site:mail]',
'subject' => '[[site:name]] "[object:label]" has been ingested',
'message' => '[object:label] has been ingested as [object:id].',
)
);
return array('islandora_object_ingested_notify_admin' => $rule);
}
Loading…
Cancel
Save