-
Notifications
You must be signed in to change notification settings - Fork 34
From Lukas' blog, rescued via the internet archive:
I need a description to change over time, but it gets cached by the system.
There are several ways to make properties of descriptions dynamic.
Override #description on the instance-side and build your descriptions programmatically. Don’t forget to copy the descriptions, in case you call super to get modify the default behavior. Pass the property a block that you send #asDynamicObject. See the senders of this message for examples. This approach is simple and works in most cases, there are some possible drawbacks however: (1) the implementation uses a proxy object that might not get properly resolved in all cases, (2) the proxy object references a block context that might not be serializeable with your preferred persistency mechanism, (3) proxies are hard to debug, and (4) from within the block you don’t have access to the described object. When I dynamically modify my descriptions, suddenly all other users also have the modified version.
Descriptions get cached by the system for efficiency reasons. If you modify a description, it is usually preferable to copy it beforehand.
I need custom CSS styling for a particular description of my Seaside form.
Send #cssClass: to add an additional CSS class to the element.