This is very confusing - I hope I manage to describe what happens correctly, but I confess I am a bit perplexed by the way contexts and View modes work.
I'm playing with Scald in a test site, using only Images, and wanted to change the display for Teaser. As I understand it this means I should:

  1. Add a context "Teaser"
  2. Teaser now appears in "Custom Display Settings" for the Scald Image Atom Type; check the box and save settings
  3. "Teaser" should now appear as one of the sub-tabs in the Scald Image "Manage Display" tab

I did this, however the new context does not show up until you flush the caches.
Once you have done this, it seems possible to switch it on and off as one likes.
I would add that - as I move back and forth between configuring the Scald Image atom type and the content type where this is used, I seem to be coming up regularly with display issues because changes take a while to take effect.

Comments

martin.knapp’s picture

Issue summary: View changes
nagy.balint’s picture

Hi!

Updating a field instance already clears the cache in the latest dev (soon to be 1.4).

It would be nice of course if adding a new context on the UI would also empty the cache.

nagy.balint’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new442 bytes

Added a clear cache call when submitting a new context on the UI.

A simple scald cache clear was not enough as we are generating new formatters for the atom reference field type.

Let me know if you need any other cache clear on the latest dev and this patch.

martin.knapp’s picture

Impressed by that quick turnaround!
But I think there is still something missing.
Correct me if I am wrong, but the process for adding (in effect) a view mode for the Scald Image atom type is as follows:

  1. add the Context
  2. configure the Transcoder for the Context in the Image atom type
  3. in "Manage Display" for the Image atom type, check the box corresponding to the new Context in "Custom Display Settings" and Save
  4. the new Context now has its own sub-tab

Thanks to the patch, (4) now works which it didn't before, however (3) still does not: the new checkbox only appears in "Custom Display Settings" once you have cleared all the caches.
Hope that helps...

nagy.balint’s picture

StatusFileSize
new471 bytes

This patch will fix the issue that the context does not appear in the list.

However even with this the tab will not appear after enabling the view mode. It will only appear after a menu rebuild.
But if i call the menu rebuild from code when i clear the other caches as well then it wont work.

So so far no idea how to fix that.

nagy.balint’s picture

As i see the only thing i could do is that after adding a new context i could mark in the system that a menu rebuild is necessary. I would not like to run it automatically as it can be a lengthy process.
But even then, the issue is that this menu rebuild is only needed if the user would like to add it as a custom view mode, for the rest of the system this is not required.
And so it would unnecessarily mark it as menu rebuild required in many cases when the user does not want to add it as a custom view mode. (Like simply using it in wysiwyg, or atom reference fields settings and so on)

Therefore maybe the best is to commit this as is, and then if anyone has a better idea we can discuss further in a followup issue.

  • nagy.balint committed 12a8fa2 on 7.x-1.x
    Issue #2474601 by nagy.balint, martin.knapp: Adding a new context does...
nagy.balint’s picture

Status: Needs review » Fixed

Committed, and the commit solves the original issue.

Solving the menu issue is more difficult and can be done in a followup issue if we find a way to do it. So far I could not, apart from always rebuilding the menu after each display save which is not that good.

martin.knapp’s picture

Status: Fixed » Active

I hope you don't mind me returning this to active.
I just tried again and the tab appeared ok if I just flushed the menu cache - would this not be the solution?

nagy.balint’s picture

Status: Active » Needs work

Doing a menu rebuild right in the submit hook where i flush the other caches did not work for me unfortunately.

Doing a menu rebuild when enabling the new context could work, but detecting that is not soo trivial, because as i noticed the current statuses are not even in entity get info.

And we would not like to do a menu rebuild each time the save button is pressed on the manage display tab.

We can let it be "needs work" then.

martin.knapp’s picture

On the UX aspect of this... changing contexts and adding new contexts to an atom is not something I would expect to be doing very often. Once you have something set up that works, my feeling is that you will be leaving it alone for quite some time while your site lives.

nagy.balint’s picture

Patches are welcome of course.

martin.knapp’s picture

I would love to... but I'm afraid that is way outside my comfort zone as far as coding goes!
But anyway, many thanks for Scald, which is a really great module - I hope you won't mind my putting in a few more suggestions for features.

nagy.balint’s picture

Not at all.