esmero / format_strawberryfield

Set of Display formatters, extractors and utils to make Strawberry field data glow
GNU Lesser General Public License v3.0
6 stars 9 forks source link

Add Usage tab + tools to Metadata Display Entities? #397

Closed DiegoPino closed 6 months ago

DiegoPino commented 9 months ago

What?

Because of Drupal's cryptic concept of Admin UI, knowing for sure (confidently) how/where a Metadata Display Entity (Twig) is being used across the complete ecosystem is a complex task, specially when you start making Magic with Views and Blocks.

The idea here is to add a Usage Tab (plus a visible Flag on the general listing) to every Metadata Display explaining to the user where/how the template is being used. This means:

Added to this, I want to also add a replace "current" with "another" template. I think this could be very useful for swapping across the whole board one template for another without having to click like 10000 times. But this also requires an extra permissions + validate if the current user has actually permissions to modify in batch all the required Configurations.

DiegoPino commented 9 months ago

(sorry for pinging... removed it... I should know better..so sorry gosh)

DiegoPino commented 9 months ago

Wonder if I should also "block" deleting a template IF there is usage ... maybe that is extra important?

alliomeria commented 9 months ago

(no worries, happy to be pinged on issues anytime)

alliomeria commented 9 months ago

Wonder if I should also "block" deleting a template IF there is usage ... maybe that is extra important?

I think this could be very helpful, but maybe provide an override for Admin users?

DiegoPino commented 9 months ago

Dealing with Layout builder Settings when trying to discover if a twig template is being used or not is a bit hellish ...

alliomeria commented 9 months ago

Dealing with Layout builder Settings when trying to discover if a twig template is being used or not is a bit hellish ...

I believe it... 🫣

DiegoPino commented 9 months ago

For the "replace" all usages with a new one, I need to make sure to show/UI wise that will only happen to "source" usages, not indirect ones.

Saying this differently. If a View Mode uses a Formatter that uses an Exposed Metadata Display Entity, we won't replace that Exposed Metadata Display Entity for a different one here, but we can/should only allow the user to replace the actual setting of an Exposed Metadata Display Entity to point to a different template.

Not sure if that makes sense/I am explaining this clearly

DiegoPino commented 9 months ago

The output so far is really interesting (for me). I need to improve the UI still.. no replacement option yet and I'm not marking in the usage listing if the usage is direct (template) or indirect (via an exposed metadata endpoint), so that is my next step. Also UI wise, just for the same of testing I'm outputting a table with no data on the second column yet. That is next. Anyways. Who cares.

image

DiegoPino commented 9 months ago

And since I am here, I should also add to the "Contextual" menu on each formatter an "Edit template" link when the formatter uses an exposed endpoint ... Right now only direct usages are being taken in account, e.g "Object description" can be edited from the little pen icon

DiegoPino commented 6 months ago

resolved via https://github.com/esmero/format_strawberryfield/commit/3e1d05214911a9c18669679c0b7d8574c4474055