Center-for-Digital-Narrative / elmcip

Electronic Literature as a Model of Creativity and Innovation in Practice (ELMCIP) is a collaborative research project funded by Humanities in the European Research Area (HERA) JRP for Creativity and Innovation built in Drupal
https://elmcip.net
4 stars 0 forks source link

Improve ORCID form validation and perhaps use a custom field formatter #467

Closed steinmb closed 3 years ago

steinmb commented 3 years ago

@AlvaroSeica wrote:

We need to look into the ORCiD field again. Either we update the descrption txt to highlight that the full URL needs to be inserted, or we allow for insertion of the ID-only code with target https://orcid.org/ + code.

I have noticed that if only the ID is inserted, the target is generated as https://elmcip.net/ + code (ERROR)

?See image below (https://elmcip.net/node/10200/edit)

Captura de ecrã 2021-05-27, às 15 31 54 Captura de ecrã 2021-05-27, às 15 32 14

Originally posted by @AlvaroSeica in https://github.com/elmcip/elmcip/issues/374#issuecomment-849638648

AlvaroSeica commented 3 years ago

I'd perhaps go for both, to prevent errors:

  1. If inserting ID, target URL is corrected to: a href="https://orcid.org/[+ID]" target="_blank" (code snippet not correct, though)
  2. Allow for the full URL as well in the field What do you think?
steinmb commented 3 years ago

ELMCIP have its own custom Digital Object Identifier field formatter. Time revisit that code I think.

steinmb commented 3 years ago

Confirm this is a bug. Have to retest the DOI field formatter. It even check to make sure the DOI string only contain the number. Viewing the node it render the DOI code with the URL hardcoded. Well, it is suppose to do that. Good catch.

steinmb commented 3 years ago

Strike that. We only have a custom validator for DOI, ORCID get no special treatment and by doing so we allow both full URL and numeric values to be used. I think that was why we decided to treat DOI with a custom formatter.

steinmb commented 3 years ago

Re-tested field. For ORCID we use the Link module. I would claim that the URL validation it provide is not working as expected, allowing this mix to me added.

Screenshot 2021-06-09 at 13 08 41

We might have to roll our own custom code for this.

AlvaroSeica commented 3 years ago

OK, thx @steinmb so should we correct the text description to tell users they should insert only the full ORCID URL (to avoid the link error)?

steinmb commented 3 years ago

We should, but one other hand, we cannot trust the user to do the right thing here. In theory the Link module should have validated the data entered and rejected non URL text, but it does not.

I have pondered a bit on this. In https://github.com/elmcip/elmcip/commit/2885d07e5d295291cee9cf6294fb175a27cbf507 is there some work in progress.

AlvaroSeica commented 3 years ago

I see. Line 35 seems to be the golden coin: return l($url, 'https://orcid.org/' . $url); Let me know when you need testing

steinmb commented 3 years ago

Pushed the following changes to test.elmcip.net - Needs to be tested though:

commit b6cc2124d7b94969e00f6ade4c7acbfa64138bb2 (HEAD -> master, origin/master, origin/HEAD) Author: Stein Magne Bjorklund steinmb@smbjorklund.com Date: Wed Jun 9 15:20:55 2021 +0200

Issue 467 Improve ORCID validation and render

Valid data is: full URL or the ORCID id.

commit cc4797c9f27b20409170725d94925330934391e9 (HEAD -> master, origin/master, origin/HEAD) Author: Stein Magne Bjorklund steinmb@smbjorklund.com Date: Wed Jun 9 17:53:28 2021 +0200

Issue 467 Update link settings with custom formatter and validator.
AlvaroSeica commented 3 years ago

Great, it works in both instances: ID code insertion and full URL