You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I moved the $field->displayformat condition to the top of the else if conditions, this respects the custom date format display and still lets you choose to input date only or with time fields too.
file:
\mod\datalynx\field\time\renderer.php
`
public function render_display_mode(stdClass $entry, array $params) {
$field = $this->_field;
$fieldid = $field->id();
$strtime = '';
if (isset($entry->{"c{$fieldid}_content"})) {
if ($content = $entry->{"c{$fieldid}_content"}) {
if (!empty($params['format'])) {
$strtime = userdate($content, $params['format']);
} else if (!empty($field->displayformat)) { // this goes to the top
$strtime = userdate($content, $field->displayformat);
} else if (isset($params['date']) || $field->dateonly) {
$strtime = userdate($content, get_string("strftimedate"));
} else if (isset($params['timestamp'])) {
$strtime = $content;
} else {
$date = getdate($content);
if ($date['seconds'] || $date['minutes'] || $date['hours']) {
$strtime = userdate($content, get_string("strftimedatetime"));
} else {
$strtime = userdate($content, get_string("strftimedate"));
}
}
}
}
return $strtime;
}`
I found that making a custom 'display format' only would affect the displayed date if 'Date only' was NOT selected.
My user expectation was that if the format is set, would override either Date or Date only.
` public function render_display_mode(stdClass $entry, array $params) {
$field = $this->_field;
$fieldid = $field->id();
The text was updated successfully, but these errors were encountered: