Newscoop rich text image captions give editors more control
The rich text captions feature, already introduced in 4.2.1, has been ported to Newscoop 4.3. It's fully available at PR-860. With this feature, editors now have much more control with the images captions. Thos with image blogs pay attention, you could greatly profit from this feature!
In the System Preferences screen under the Editor Settings tab, you can enable this feature. The default is set to 'disabled'. Once enabled, it's also possible to set a character limit. For no character limit, set it to 0. Note that all captions in Newscoop turn into rich text captions.
The already available permissions for the rich text editor in Newscoop have also been applied to this editor.
When it comes to templating, not all templates support captions by default, or they may not use the feature to the fullest. We recommended testing the feature with your templates and implementing corrections where needed. To help you adjust the templates, I'll provide a few examples below on how to integrate the feature successfully.
There are two new functionalities in Smarty, 'getSystemPreference' and 'wrap_in_element'. The method 'getSystemPreference' is available on the $gimme object. See this blog post for more information. The function 'wrap_in_element' can wrap a string in an HTML-element. It accepts three parameters, string, element and attributes. The attribute string represents the string to be wrapped, or for our purposes, the caption. The attribute element is the element in which to wrap the string. The attribute attributes is a string of attributes which will be applied to the element.
Captions with feature disabled
{{ $image->caption|strip_tags }}
It's advisable to always use strip tags, especially in cases where Rich Text Captions have been enabled and used, since the system will not change your captions until you manually re-save them.
Captions with feature enabled
{{ $image->caption }}
Flexible templates
{{ if $gimme->getSystemPreference('MediaRichTextCaptions', 'N') == 'Y' }}
{{ wrap_in_element string=$image->caption element=div attributes='class="image-caption"' }}
{{ else }}
{{ $image->caption|strip_tags }}
{{ /if }}
Default Newscoop Themes
Default themes assume the rich text caption setting is off, so be sure to make the proper modifications when enabling this feature.