Skip to content
Snippets Groups Projects

ISTWCMS-5214: adding theming for opportunity nodes and fixing dates

Merged Eric Bremner requested to merge feature/ISTWCMS-5214-ebremner-theme-opportunity-node into 1.0.x
1 file
+ 12
11
Compare changes
  • Side-by-side
  • Inline
@@ -84,6 +84,10 @@ class UwNodeContent {
case 'uw_ct_service':
$content_data = $this->getServiceContent($node_flags);
break;
case 'uw_ct_opportunity':
$content_data = $this->getOpportunityContent($node_flags, $view_mode);
break;
}
return $this->uwNodeData->getNodeData($node, $view_mode, $content_data);
@@ -622,6 +626,66 @@ class UwNodeContent {
return $content_data;
}
/**
* Get the node content for opportunity content type.
*
* @param array $node_flags
* The flags for the node.
* @param string $view_mode
* The view mode for this node.
*
* @return array
* Array of content to get from the node.
*/
public function getOpportunityContent(array $node_flags, string $view_mode): array {
// Get the content data.
$content_data = $this->setupContentData($node_flags);
// Setup the header content.
if ($node_flags['get_header'] && $view_mode !== 'teaser') {
$content_data['header']['opportunity_type'] = $this->addToContentData('terms', ['field_uw_opportunity_type']);
$content_data['header']['employment_type'] = $this->addToContentData('terms', ['field_uw_opportunity_employment']);
$content_data['header']['rate_of_pay'] = $this->addToContentData('plain_text', 'field_uw_opportunity_pay_rate');
$content_data['header']['rate_of_pay_type'] = $this->addToContentData('terms', ['field_uw_opportunity_pay_type']);
$content_data['header']['job_id'] = $this->addToContentData('plain_text', 'field_uw_opportunity_job_id');
}
// If we are on a teaser, send some fields to the footer,
// so that the display after the content.
if ($view_mode == 'teaser') {
$content_data['footer']['posted'] = $this->addToContentData('date', 'field_uw_opportunity_date');
$content_data['footer']['deadline'] = $this->addToContentData('date', 'field_uw_opportunity_deadline');
$content_data['footer']['opportunity_type'] = $this->addToContentData('terms', ['field_uw_opportunity_type']);
}
if ($node_flags['get_footer']) {
$content_data['footer']['links']['has_children'] = TRUE;
$content_data['footer']['links']['application'] = $this->addToContentData('link', 'field_uw_opportunity_link');
$content_data['footer']['links']['additional_info'] = $this->addToContentData('link', 'field_uw_opportunity_additional');
$content_data['footer']['links']['contact'] = $this->addToContentData('link', 'field_uw_opportunity_contact');
$content_data['footer']['opportunity_details']['has_children'] = TRUE;
$content_data['footer']['opportunity_details']['posted_by'] = $this->addToContentData('plain_text', 'field_uw_opportunity_post_by');
$content_data['footer']['opportunity_details']['number_of_positions'] = $this->addToContentData('select', 'field_uw_opportunity_pos_number');
$content_data['footer']['opportunity_details']['reports_to'] = $this->addToContentData('plain_text', 'field_uw_opportunity_report');
$content_data['footer']['opportunity_dates']['has_children'] = TRUE;
$content_data['footer']['opportunity_dates']['posted'] = $this->addToContentData('date', 'field_uw_opportunity_date');
$content_data['footer']['opportunity_dates']['deadline'] = $this->addToContentData('date', 'field_uw_opportunity_deadline');
$content_data['footer']['opportunity_dates']['start_date'] = $this->addToContentData('date', 'field_uw_opportunity_start_date');
$content_data['footer']['opportunity_dates']['end_date'] = $this->addToContentData('date', 'field_uw_opportunity_end_date');
}
// Setup the actual content.
if ($node_flags['get_content']) {
$content_data['content'] = $this->addToContentData('content', 'field_uw_opportunity_position');
}
return $content_data;
}
/**
* Gets the most recent date.
*
@@ -630,10 +694,10 @@ class UwNodeContent {
* @param string $type
* The type of date.
*
* @return string
* The actual date with proper format.
* @return array
* The array of dates.
*/
public function getDate(array $date, string $type): string {
public function getDate(array $date, string $type): array {
return $this->uwNodeData->getDate($date, $type);
}
Loading