Skip to content
Snippets Groups Projects
Commit 3114928e authored by Eric Bremner's avatar Eric Bremner Committed by Kevin Paxman
Browse files

ISTWCMS-5266: adding logic on contact for which image to use

parent b3a42467
No related branches found
No related tags found
1 merge request!192ISTWCMS-5266: adding logic on contact for which image to use
......@@ -74,7 +74,7 @@ class UwNodeContent {
break;
case 'uw_ct_contact':
$content_data = $this->getContactContent($node_flags);
$content_data = $this->getContactContent($node_flags, $view_mode);
break;
case 'uw_ct_profile':
......@@ -467,11 +467,13 @@ class UwNodeContent {
*
* @param array $node_flags
* The flags for the node.
* @param string $view_mode
* The view mode of the node.
*
* @return array
* Array of content to get from the node.
*/
public function getContactContent(array $node_flags): array {
public function getContactContent(array $node_flags, string $view_mode): array {
// Get the content data.
$content_data = $this->setupContentData($node_flags);
......@@ -481,8 +483,19 @@ class UwNodeContent {
$content_data['header']['position'] = $this->addToContentData('plain_text', 'field_uw_ct_contact_title');
}
// If there is an image, we have to decide on which to get based
// on the view mode.
if ($node_flags['get_image']) {
$content_data['image'] = $this->addToContentData('image', 'field_uw_ct_contact_image');
// If it is a teaser use the listing image, if not use the portrait image.
if ($view_mode == 'teaser') {
$content_data['image'] = $this->addToContentData('image', 'field_uw_contact_listing_image');
}
else {
$content_data['image'] = $this->addToContentData('image', 'field_uw_ct_contact_image');
}
// Add the extra options for portrait image style.
$content_data['image']['extra_options'] = [
'type' => 'portrait',
'crop' => 'portrait',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment