Browse Source

Pulled filepath.

pull/907/head
Alan Stanley 7 years ago
parent
commit
4efc7a3a18
  1. 2
      README.md
  2. 1
      islandora_fits.module
  3. 8
      src/Services/XMLTransform.php

2
README.md

@ -1,2 +1,2 @@
# islandora_fits
# Islandora FITS
Config module to make Islandora aware of FITS microservice

1
islandora_fits.module

@ -81,6 +81,7 @@ function islandora_fits_media_presave(MediaInterface $media) {
$file_id = $media->get('field_media_file')->getValue()[0]['target_id'];
$file = File::load($file_id);
$data = file_get_contents($file->getFileUri());
// Adds any new fields to FITS content type.
$transformer->add_node_fields($data);
$transformer->populate_node($data, $attached);
$attached->save();

8
src/Services/XMLTransform.php

@ -51,7 +51,7 @@ class XMLTransform extends ServiceProviderBase {
$variables['islandora_fits_data'][$tool_name] = array();
$rows = &$variables['islandora_fits_data'][$tool_name];
foreach ($vals_array as $field => $val_array) {
if (!array_key_exists($field, $rows)) {
if (!array_key_exists($field, $rows) && $field != 'Filepath') {
$rows[$field] = array(
array('data' => Xss::filter($field), 'class' => 'islandora_fits_table_labels'),
);
@ -117,7 +117,7 @@ class XMLTransform extends ServiceProviderBase {
* @return array
* An array containing key/value pairs of fields and data.
*/
public function islandora_fits_child_xpath($xml) {
private function islandora_fits_child_xpath($xml) {
$results = $xml->xpath('/*|/*/fits:metadata');
$output = array();
foreach ($results as $result) {
@ -139,7 +139,7 @@ class XMLTransform extends ServiceProviderBase {
* @param array $output
* An array containing key/value pairs of fields and data.
*/
public function islandora_fits_children($child, &$output) {
private function islandora_fits_children($child, &$output) {
$grandchildren = $child->xpath('*/*');
if (count($grandchildren) > 0) {
@ -203,7 +203,7 @@ class XMLTransform extends ServiceProviderBase {
* @return array
* Constructed node name for output.
*/
public function islandora_fits_construct_output($node_name, $tool_name) {
private function islandora_fits_construct_output($node_name, $tool_name) {
// Construct an arbitrary string with all capitals in it.
$capitals = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$name_array = str_split($node_name);

Loading…
Cancel
Save