WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.18k forks source link

Make it more obvious in the site editor whether a template / template part is modified or reading from disk #66646

Open fabiankaegy opened 1 day ago

fabiankaegy commented 1 day ago

Especially in larger WordPress installations we almost never want templates / template parts to get modified in a production environment. Because when you do so you get locked out of code updates. And the templates/template-parts are usually managed in Git.

Currently it is almost impossible without manually checking every single templates action dropdown menu whether the template has bee modified or not.

It would be great to add a new field to the DataView that indicates whether the template has been modified. This field doesn't need to be enabled by default. But it should be one of the options of the DataView.

fabiankaegy commented 1 day ago

There is a hacky CSS was of achieving this which is basically doing:

[aria-label="Templates"] .dataviews-view-grid__card:has(input[type="checkbox"][aria-disabled="false"]) {
    border: 5px solid red !important;
}

Which uses the fact that any modified templates have the checkbox enabled where as unmodified has the checkbox disabled. But an actual native solution would be much preferred :)