GetDKAN / dkan

DKAN Open Data Portal
https://dkan.readthedocs.io/en/latest/index.html
GNU General Public License v2.0
366 stars 170 forks source link

Expose dataset properties as pseudo/extra fields #4115

Open stefan-korn opened 7 months ago

stefan-korn commented 7 months ago

User Story

One might find it beneficial to expose the dataset properties as pseudo/extra fields to use them in the display mode settings of data content type at admin/structure/types/manage/data/display

Remark: To use this, one would need to change/override the template modules/metastore/templates/node--data.html.twig

Acceptance Criteria

Show properties of dataset at admin/structure/types/manage/data/display and output them if configured.

dafeder commented 5 months ago

Taking a look at this -- in general I'm wary of making promises of integrating with Drupal field system that will be too difficult/complex to keep with different kinds of schemas. But I'll reserve judgement till I've taken your PR for a spin :)

stefan-korn commented 5 months ago

@dafeder : I understand that you are wary of this.

But if one plans to use heavily customized schema (and not planning to use the React frontend) the preprocessing at metastore_preprocess_node__data and the fixed node template seems kind of very hardcoded and lack flexibility imho. Getting the schema properties back in the Drupal fields with using the Search API implementation seems very flexible to me, so I would at least like to share this with you. We can realize a few things with this solution very easy without doing too much hardcoding.

swirtSJW commented 4 months ago

I see a real power in this, especially as it paves the way for being able to surface JSON Metadata elements in Views.

stefan-korn commented 4 months ago

I need a somehow more sophisticated version of this (providing labels, etc.). So I will be going with a separate module for now. Will mention the module in the discussions section later on.

dafeder commented 3 months ago

Yes interested to see what you're doing @stefan-korn. Perhaps we should keep the issue open but close your PR #4116 for now?

stefan-korn commented 3 months ago

@dafeder : Yes, makes sense to close PR. It surely has some difficulties and at least it clutters the Display View UI with a lot of fields. So this should probably not something that is active by default, but only as needed. So I will be going forward with the module and if at some point, there is an interest of getting this in DKAN core, we can see / talk.

@swirtSJW : Thanks for your input and I do agree that there is some power in this :-) Though for views, extra fields are not directly helpful, at least not if you use a field based view display.

stefan-korn commented 3 months ago

The module is already there: https://www.drupal.org/project/dkan_extra_fields - but still a dev version, therefore I did not mention in Discussions yet.

dafeder commented 3 months ago

I don't think it needs a 1.0 release to share in discussions but up to you! Will check it out.