Skip to content
Snippets Groups Projects

ISTWCMS-4877: adding additional information for catalogs

Merged Eric Bremner requested to merge feature/ISTWCMS-4877-ebremner-catalog-node-page into 1.0.x
1 file
+ 43
2
Compare changes
  • Side-by-side
  • Inline
+ 43
2
@@ -226,9 +226,16 @@ class UWService implements UWServiceInterface {
@@ -226,9 +226,16 @@ class UWService implements UWServiceInterface {
case 'uw_ct_catalog_item':
case 'uw_ct_catalog_item':
 
$tags = [
 
'Category' => 'field_uw_catalog_category',
 
'Faculty' => 'field_uw_catalog_faculty',
 
'Audience' => 'field_uw_audience',
 
];
 
$content_data = [
$content_data = [
'title' => $get_title ? TRUE : NULL,
'title' => $get_title ? TRUE : NULL,
'content' => $get_content ? 'layout_builder__layout' : NULL,
'content' => $get_content ? 'layout_builder__layout' : NULL,
 
'catalog_tags' => $get_footer ? $tags : NULL,
];
];
break;
break;
@@ -330,8 +337,11 @@ class UWService implements UWServiceInterface {
@@ -330,8 +337,11 @@ class UWService implements UWServiceInterface {
$node_data['date'] = $this->uwGetDates($node, $data);
$node_data['date'] = $this->uwGetDates($node, $data);
break;
break;
 
case 'audience':
 
case 'category':
 
case 'faculty':
case 'groups':
case 'groups':
$node_data['groups'] = $this->uwGetTermsFromEntityField($node->$data, 'tags');
$node_data[$index] = $this->uwGetTermsFromEntityField($node->$data, 'tags');
break;
break;
case 'image':
case 'image':
@@ -362,12 +372,42 @@ class UWService implements UWServiceInterface {
@@ -362,12 +372,42 @@ class UWService implements UWServiceInterface {
$node_data['hero'] = $this->uwGetSources($node, $data);
$node_data['hero'] = $this->uwGetSources($node, $data);
break;
break;
 
case 'catalog_tags':
 
 
// Empty arrays so that we don't get undefined
 
// index errors.
 
$tabs = [];
 
$tags = [];
 
 
// Get the entity and values for the catalog,
 
// which is the taxonomy term catalog.
 
$catalog_entity = $node->field_uw_catalog_catalog->entity;
 
$tabs_values = $catalog_entity->field_uw_catalog_tabs_display->getValue();
 
 
// Setup the array that we can use for in_array,
 
// which is the tabs to be displayed.
 
foreach ($tabs_values as $tab_value) {
 
$tabs[] = $tab_value['value'];
 
}
 
 
// If there are tabs, then get them.
 
if (!empty($tabs)) {
 
foreach ($data as $key => $field) {
 
if (in_array($key, $tabs)) {
 
$tags[$key] = $this->uwGetTermsFromEntityField($node->$field, 'tags');
 
}
 
}
 
}
 
 
$node_data[$index] = $tags;
 
break;
 
case 'tags':
case 'tags':
$tags = [];
$tags = [];
foreach ($data as $field) {
foreach ($data as $field) {
$tags = array_merge($tags, $this->uwGetTermsFromEntityField($node->$field, 'tags'));
$tags = array_merge($tags, $this->uwGetTermsFromEntityField($node->$field, 'tags'));
}
}
$node_data['tags'] = [$tags];
$node_data[$index] = [$tags];
break;
break;
case 'title':
case 'title':
@@ -419,6 +459,7 @@ class UWService implements UWServiceInterface {
@@ -419,6 +459,7 @@ class UWService implements UWServiceInterface {
'uw_ct_event',
'uw_ct_event',
'uw_ct_news_item',
'uw_ct_news_item',
'uw_ct_profile',
'uw_ct_profile',
 
'uw_ct_catalog_item',
];
];
break;
break;
Loading