Browse Source

add versioning true/false

pull/733/head
Eli Zoller 7 years ago
parent
commit
7821227bb5
  1. 15
      modules/islandora_core_feature/config/install/system.action.version_node_in_fedora.yml
  2. 1
      src/EventGenerator/EmitEvent.php
  3. 5
      src/EventGenerator/EventGenerator.php
  4. 15
      src/Plugin/ContextReaction/VersionReaction.php

15
modules/islandora_core_feature/config/install/system.action.version_node_in_fedora.yml

@ -0,0 +1,15 @@
langcode: en
status: true
dependencies:
enforced:
module:
- islandora_core_feature
module:
- islandora
id: version_node_in_fedora
label: 'Version Node in Fedora'
type: node
plugin: emit_node_event
configuration:
queue: islandora-indexing-fcrepo-content
event: Version

1
src/EventGenerator/EmitEvent.php

@ -207,6 +207,7 @@ abstract class EmitEvent extends ConfigurableActionBase implements ContainerFact
'#description' => t('Type of event to emit'),
'#options' => [
'Create' => t('Create'),
'Version' => t('Version'),
'Update' => t('Update'),
'Delete' => t('Delete'),
'Generate Derivative' => t('Generate Derivative'),

5
src/EventGenerator/EventGenerator.php

@ -104,6 +104,11 @@ class EventGenerator implements EventGeneratorInterface {
$event["type"] = ucfirst($data["event"]);
$event["summary"] = ucfirst($data["event"]) . " a " . ucfirst($entity_type);
}
if ($data["event"] == "Update"){
$event["object"]["createVersion"] = TRUE;
} else {
$event["object"]["createVersion"] = FALSE;
}
// Add REST links for non-file entities.
if ($entity_type != 'file') {

15
src/Plugin/ContextReaction/VersionReaction.php

@ -0,0 +1,15 @@
<?php
namespace Drupal\islandora\Plugin\ContextReaction;
use Drupal\islandora\PresetReaction\PresetReaction;
/**
* Versioning context reaction.
*
* @ContextReaction(
* id = "version",
* label = @Translation("Version")
* )
*/
class VersionReaction extends PresetReaction {}
Loading…
Cancel
Save