Hi, thanks for creating this module. I had an interesting use case. The normal use of this module is to show markup on the node edit form and sometimes on the node view as well. I was trying to get a markup field to be visible on only some entity view modes, but didn't really need it to display on the node form. I wanted some html to appear on just some view modes that the user couldn't edit. (And I didn't want to bother with the theme templates)

It appears that the module only relies on the Default view mode so I was not able, for example, to hide the html on the Default view mode and the node edit but show it on my custom defined View mode (called Newsletter).

I am working on a patch.

CommentFileSizeAuthor
#1 markup-view-modes-1812086-1.patch3.8 KBnubeli

Comments

nubeli’s picture

Status: Active » Needs review
StatusFileSize
new3.8 KB

I created a patch so that the formatting can be set per entity view mode, as the way the view modes were intended to work. Now the markup can be hidden or shown on view modes for unique views.

I also changed the approach for toggling the markup showing up on node edit/view. It is confusing to use the formatter as a way of toggling showing it on the node edit/view, since formatters are themselves dependent of the context.

I could confusingly set it to be "Edit form only" on one view mode but "Always visible" on another. But the user doesn't know that it's only the Default view mode that determines it. Instead that toggle should be on the field settings so it's clear it's universal for that field.

I added a field setting "Show on edit form" and reduced the formatter to just a Default. This allows the user to toggle showing markup on the node edit form or not. And in the view modes they make separate decisions on whether to show the markup there.

Hopefully that improves it a little. Thanks!

tedbow’s picture

This works great for me and makes the module more useful.

I think it makes a lot more sense to use the regular "hidden" functionality in Manage Display screen rather than to have the "Always Visible".

One suggestion would to have ""Show on edit form" default to being checked because this the default behavior of the module now.

tedbow’s picture

Status: Needs review » Needs work

The only problem I see with this patch is that doesn't provide hook_update_n implementation to make existing Markup fields to maintain their current functionality. Though I think the way this patch works is better than the current system current users should not have go the configuration of every Markup field and make updates after this patch.

For instance if the field currently set to "Edit form only" it should be set to "hidden" for all View Modes.

Also for all existing markup fields "Show on edit form" should be set to true because they will be all showing on the forms before the patch.

It would good to get some feedback from 1 of the module maintainers. It wouldn't make sense for me or someone else to put time into writing the hook_update_n if they don't plan to include these changes in the module.

Thanks