Skip to content

Commit

Permalink
TW-236: Disabled escpaing when RichTextCaption setting is on
Browse files Browse the repository at this point in the history
  • Loading branch information
m038 committed Jul 17, 2015
1 parent 2049134 commit 49e0dd6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion newscoop/include/smarty/campsite_plugins/block.image.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,17 @@ function smarty_block_image(array $params, $content, Smarty_Internal_Template $s
}

$imageService = \Zend_Registry::get('container')->getService('image');
$preferencesService = \Zend_Registry::get('container')->getService('preferences');
$caption = $imageService->getCaption($articleRendition->getImage(), $article->number, $article->language->number);
if ($preferencesService->get('MediaRichTextCaptions', 'N') == 'N') {
$caption = MetaDbObject::htmlFilter($caption);
}

$smarty->assign('image', (object) array(
'src' => \Zend_Registry::get('view')->url(array('src' => $image['src']), 'image', true, false),
'width' => $image['width'],
'height' => $image['height'],
'caption' => $imageService->getCaption($articleRendition->getImage(), $article->number, $article->language->number),
'caption' => $caption,
'description' => $articleRendition->getImage()->getDescription(),
'photographer' => $articleRendition->getImage()->getPhotographer(),
'original' => $image['original'],
Expand Down
5 changes: 5 additions & 0 deletions newscoop/template_engine/metaclasses/MetaImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function __construct($p_imageId = null)
$this->m_customProperties['type'] = 'getType';
$this->m_customProperties['photographer_url'] = 'getPhotographerUrl';
$this->m_customProperties['caption'] = 'getCaption';

$preferencesService = \Zend_Registry::get('container')->getService('preferences');
if ($preferencesService->MediaRichTextCaptions == 'Y') {
$this->m_skipFilter = array('caption');
}
} // fn __construct


Expand Down

0 comments on commit 49e0dd6

Please sign in to comment.