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:
- Add a context "Teaser"
- Teaser now appears in "Custom Display Settings" for the Scald Image Atom Type; check the box and save settings
- "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
Comment #1
martin.knapp commentedComment #2
nagy.balint commentedHi!
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.
Comment #3
nagy.balint commentedAdded 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.
Comment #4
martin.knapp commentedImpressed 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:
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...
Comment #5
nagy.balint commentedThis 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.
Comment #6
nagy.balint commentedAs 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.
Comment #8
nagy.balint commentedCommitted, 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.
Comment #9
martin.knapp commentedI 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?
Comment #10
nagy.balint commentedDoing 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.
Comment #11
martin.knapp commentedOn 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.
Comment #12
nagy.balint commentedPatches are welcome of course.
Comment #13
martin.knapp commentedI 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.
Comment #14
nagy.balint commentedNot at all.