Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_cfg_common
Commits
eda8bc96
Commit
eda8bc96
authored
3 years ago
by
Eric Bremner
Committed by
Martin Leblanc
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5214: adding theming for opportunity nodes and fixing dates
parent
69921537
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!188
ISTWCMS-5214: adding theming for opportunity nodes and fixing dates
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Service/UWService.php
+2
-0
2 additions, 0 deletions
src/Service/UWService.php
src/Service/UwNodeContent.php
+53
-0
53 additions, 0 deletions
src/Service/UwNodeContent.php
src/Service/UwNodeFieldValue.php
+19
-18
19 additions, 18 deletions
src/Service/UwNodeFieldValue.php
with
74 additions
and
18 deletions
src/Service/UWService.php
+
2
−
0
View file @
eda8bc96
...
...
@@ -190,6 +190,7 @@ class UWService implements UWServiceInterface {
'uw_ct_contact'
,
'uw_ct_event'
,
'uw_ct_news_item'
,
'uw_ct_opportunity'
,
'uw_ct_profile'
,
'uw_ct_web_page'
,
'uw_ct_service'
,
...
...
@@ -202,6 +203,7 @@ class UWService implements UWServiceInterface {
'uw_ct_contact'
,
'uw_ct_event'
,
'uw_ct_news_item'
,
'uw_ct_opportunity'
,
'uw_ct_profile'
,
'uw_ct_catalog_item'
,
'uw_ct_service'
,
...
...
This diff is collapsed.
Click to expand it.
src/Service/UwNodeContent.php
+
53
−
0
View file @
eda8bc96
...
...
@@ -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
);
break
;
}
return
$this
->
uwNodeData
->
getNodeData
(
$node
,
$view_mode
,
$content_data
);
...
...
@@ -622,6 +626,55 @@ class UwNodeContent {
return
$content_data
;
}
/**
* Get the node content for opportunity content type.
*
* @param array $node_flags
* The flags for the node.
*
* @return array
* Array of content to get from the node.
*/
public
function
getOpportunityContent
(
array
$node_flags
):
array
{
// Get the content data.
$content_data
=
$this
->
setupContentData
(
$node_flags
);
// Setup the header content.
if
(
$node_flags
[
'get_header'
])
{
$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
(
$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_blog_summary'
);
}
return
$content_data
;
}
/**
* Gets the most recent date.
*
...
...
This diff is collapsed.
Click to expand it.
src/Service/UwNodeFieldValue.php
+
19
−
18
View file @
eda8bc96
...
...
@@ -677,17 +677,14 @@ class UwNodeFieldValue {
* The field name that has the date(s).
* @param string $view_mode
* The view mode of the node.
*
* @return array
* Array of dates.
*/
public
function
getDates
(
Node
$node
,
string
$field_name
,
string
$view_mode
)
:
array
{
public
function
getDates
(
Node
$node
,
string
$field_name
,
string
$view_mode
)
{
$return_dates
=
[];
// If this is not and event, just get the date.
if
(
$node
->
getType
()
!==
'uw_ct_event'
)
{
$return_dates
[]
=
date
(
'l, F j, Y'
,
strtotim
e
(
$node
->
$field_name
->
value
)
);
$return_dates
[]
=
$this
->
getDat
e
(
[
$node
->
$field_name
->
value
],
'blog'
);
}
else
{
...
...
@@ -851,33 +848,37 @@ class UwNodeFieldValue {
* @param string $type
* The type of date.
*
* @return
string
* A
converted date to a string
.
* @return
array
* A
n array about a date
.
*/
public
function
getDate
(
array
$date
,
string
$type
):
string
{
public
function
getDate
(
array
$date
,
string
$type
):
array
{
$return_date
=
''
;
$return_date
=
[]
;
if
(
$type
==
'event'
)
{
// If this is the same day, get the date and the start and end times.
if
(
$date
[
'duration'
]
<
'1439'
)
{
$
start
_date
=
date
(
self
::
DATE_FORMAT_DATE_TIME
,
$date
[
'value'
])
;
$
end_date
=
date
(
self
::
DATE_FORMAT_TIME_ONLY
,
$date
[
'end_value'
])
;
$return_date
=
$start_date
.
' - '
.
$end_date
.
' '
.
date
(
'T'
,
$date
[
'end_value'
]
)
;
$
return
_date
[
'
date
_range'
]
=
TRUE
;
$
return_date
[
'same_day'
]
=
TRUE
;
$return_date
[
'start_date'
]
=
$date
[
'value'
];
$return_date
[
'end_date'
]
=
$date
[
'end_value'
];
}
// This is not the day, get the start and end date with time.
elseif
(
$date
[
'duration'
]
>
'1439'
)
{
$
start
_date
=
date
(
self
::
DATE_FORMAT_DATE_TIME
,
$date
[
'value'
])
;
$
end_date
=
date
(
self
::
DATE_FORMAT_DATE_TIME
,
$date
[
'end_value'
])
;
$return_date
=
$start_date
.
' - '
.
$end_date
.
' '
.
date
(
'T'
,
$date
[
'end_value'
]
)
;
$
return
_date
[
'
date
_range'
]
=
TRUE
;
$
return_date
[
'same_day'
]
=
FALSE
;
$return_date
[
'start_date'
]
=
$date
[
'value'
];
$return_date
[
'end_date'
]
=
$date
[
'end_value'
];
}
// The all date case, duration is always 1439.
else
{
$return_date
=
date
(
self
::
DATE_FORMAT_DATE_ONLY
,
$date
[
'value'
])
.
' (all day)'
;
$return_date
[
'all_day'
]
=
TRUE
;
$return_date
[
'date'
]
=
$date
[
'value'
];
}
}
else
{
$return_date
[
'date'
]
=
$date
[
0
];
}
return
$return_date
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment