Closed bondjimbond closed 5 years ago
Using templates predates our migration from CONTENTdm, so we encounter that problem. But good point. I'll let @MarcusBarnes weigh in, but I think that it could be possible to add logic so that the code that calls https://github.com/MarcusBarnes/mik/blob/master/src/metadataparsers/mods/CdmToMods.php#L74 could be bypassed, using nicknames would work fine. A new option in the metadata parser's .ini section could indicate that the code should be bypassed. I haven't taken a detailed look but that's a place to start.....
@mjordan Your suggestion would be a good first way of approaching this. @bondjimbond Have you heard feedback from anyone else whether this would be helpful? It's a good suggestion for those like @bondjimbond who have ongoing work dealing with CDM toolchains and are familiar enough with how CONTENTdm works to be able to figure out nicknames directly.
Thanks @MarcusBarnes. @bondjimbond I've added the logic I was describing to issue-482 branch. You will need to add the following to the [METADATA_PARSER]
section of your .ini file:
use_nicknames = true
I haven't tested this at all, but it should work.
It seems to work! Which is great, because even field names without spaces were getting messed up in my Twig templates.
Update: definitely working, and working so much better than the alternative. (This is important when you have fields with names like Latitude (°,'N)
). I'd say it's good to go for a pull request.
Super! That was lucky, changing code without testing it.
I'll update the wiki in a couple of hours and have you take a look, and then we can merge.
@bondjimbond can you send me a sample .ini file where you use this new 'feature'? I assume that you were using
[METADATA_PARSER]
class = templated\Templated
use_nicknames = true
with no mention of Cdm in the [METADATA_PARSER]
section your but I'd like to confirm that.
Sent via email.
[METADATA_PARSER]
class = mods\CdmToMods
alias = Herbarium
ws_url = "http://deck.cs.athabascau.ca/dmwebservices/index.php?q="
; Path to the csv file that contains the CONTENTdm to MODS mappings.
mapping_csv_path = 'Athabasca/metadata/herbarium_nicknames_mapping.csv'
; Include the migrated from uri into your generated metadata (e.g., MODS)
include_migrated_from_uri = TRUE
repeatable_wrapper_elements[] = extension
repeatable_wrapper_elements[] = name
repeatable_wrapper_elements[] = subject
repeatable_wrapper_elements[] = identifier
repeatable_wrapper_elements[] = titleInfo
repeatable_wrapper_elements[] = title
repeatable_wrapper_elements[] = relatedItem
use_nicknames = true
Glad I asked - I assumed you were using the Templated metadata parser and not CdmToMods. I guess that means you are also using the InsertXmlFromTemplate in conjuction with CdmToMods? It would be great if this new option would apply to both the CdmToMods metadata parser + InsertXmlFromTemplate manipulator and the Templated metadata parser when used in a Cdm toolchain. If it doesn't, let's pass on that for now and only implement it in CdmToMods and create a new ticket for that feature.
I guess that means you are also using the InsertXmlFromTemplate in conjuction with CdmToMods?
Yep - I sent you the full file by email, so you should see everything I'm doing there.
It would be great if this new option would apply to both the CdmToMods metadata parser + InsertXmlFromTemplate manipulator and the Templated metadata parser when used in a Cdm toolchain.
I haven't done anything with the "Templated" parser and have no plans to, so I'm happy enough with CdmToMods for now.
Unlike me, who is using mappings files less and less and drinking the Twig koolaide more and more. But I may never use Cdm toolchains again in production :champagne:
Let me do up some docs based on what you have provided and then I'll open a PR for this.
@bondjimbond Would you mind sharing your mappings file as well so I am completely clear on what we're doing here?
Thanks, that's useful.
Take a look at https://github.com/MarcusBarnes/mik/wiki/Cookbook:-Using-CONTENTdm-field-nicknames-instead-of-labels and let me know if it needs any changes (or go ahead and change it yourself).
PR is in #487.
Works for me.
It's a lot easier to work with machine names ("nicknames") for CDM fields rather than the field display names, because the field names can be full of spaces, punctuation, etc. This makes it really hard to use Twig templates, among other things. Any way to get an option to use nicknames instead?