diff --git a/README.md b/README.md index 6ec40b2..80eedd1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ [Twig Documentation] (http://twig.sensiolabs.org/documentation) - ### Why Use Multi-importer * UI driven integrated workflow for ingest and update * Metadata Cleanup: Export your MODS metadata as CSV via Solr, clean up, then update the MODS datastream of the objects by recreating the MODS datastream using Twig @@ -33,7 +32,8 @@ * To take advantage of the Twig Templating system for creating MODS from CSVs * To preview the MODS output easily * Supports integration with Google Spreadsheets, Zip/Local/Amazon storage and Complex storage needs via hooks. +* Added Jasny Pcre Extension. Twig templates can now support regular expressions. Be mindful of needing doubly escaped backslashes in situations that require regex with backslashes. ### Updating existing Objects * To enable this functionality without any warnings you need to use https://github.com/mnylc/islandora_batch/tree/7.x-ISLANDORA-2046 instead of main Islandora Batch release. We are working on making those changes into the main release. -* Objects (PIDs) present in other Batch Sets won't be able to be updated because Islandora Batch only allows a single PID to exist in its DB. We are working on fixing that inside 7.x-ISLANDORA-2046. For now, please delete old batch sets if you plan on updating existing Objects that were ingested using Islandora Batch. \ No newline at end of file +* Objects (PIDs) present in other Batch Sets won't be able to be updated because Islandora Batch only allows a single PID to exist in its DB. We are working on fixing that inside 7.x-ISLANDORA-2046. For now, please delete old batch sets if you plan on updating existing Objects that were ingested using Islandora Batch. diff --git a/composer.json b/composer.json index 9fea60a..a63caf0 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "react/http": "^0.4.1", "phpoffice/phpexcel": "^1.8", "google/apiclient": "^2.0", - "cache/filesystem-adapter": "^0.3.3" + "cache/filesystem-adapter": "^0.3.3", + "jasny/twig-extensions": "^1.3" }, "authors": [ { diff --git a/includes/import.form.inc b/includes/import.form.inc index 0482495..9cea507 100644 --- a/includes/import.form.inc +++ b/includes/import.form.inc @@ -572,6 +572,7 @@ function islandora_multi_importer_twig_form($form, &$form_state, $file_data) { 'debug' => TRUE, )); $twig->addExtension(new Twig_Extension_Debug()); + $twig->addExtension(new Jasny\Twig\PcreExtension()); $validated = TRUE; try { diff --git a/includes/utilities.inc b/includes/utilities.inc index 57365d6..c54ee74 100755 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -355,7 +355,8 @@ function islandora_multi_importer_twig_process(array $twig_input = array()) { $twig = new \Twig_Environment($loader, array( 'cache' => drupal_realpath('private://'), )); - + $twig->addExtension(new Jasny\Twig\PcreExtension()); + //We won't validate here. We are here because our form did that $output = $twig->render($twig_input['name'], $twig_input['data']); //@todo catch anyway any twig error to avoid the worker to fail bad.