Skip to content

Commit

Permalink
Calendar Settings: Separate groupings for Post Statuses, Revision Sta…
Browse files Browse the repository at this point in the history
…tuses
  • Loading branch information
agapetry committed Jan 29, 2025
1 parent f1215bb commit d586f54
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions modules/calendar/library/calendar-methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ public function settings_show_posts_publish_time_option()

$field_name = esc_attr($this->module->options_group_name) . '[show_posts_publish_time]';

$customStatuses = $publishpress->getCustomStatuses();
$customStatuses = \PublishPress_Statuses::getCustomStatuses(['for_revision' => false], 'object');

$revisionStatuses = (defined('PUBLISHPRESS_STATUSES_PRO_VERSION'))
? \PublishPress_Statuses::getCustomStatuses(['for_revision' => true], 'object')
: [];

if (empty($customStatuses)) {
$statuses = [
Expand All @@ -199,7 +203,11 @@ public function settings_show_posts_publish_time_option()
$statuses = [];

foreach ($customStatuses as $status) {
$statuses[$status->slug] = ['title' => $status->label, 'status_obj' => $status];
$statuses[$status->slug] = ['title' => $status->label, 'status_obj' => $status, 'for_revision' => false];
}

foreach ($revisionStatuses as $status) {
$statuses[$status->slug] = ['title' => $status->label, 'status_obj' => $status, 'for_revision' => true];
}
}

Expand Down Expand Up @@ -241,7 +249,14 @@ public function settings_show_posts_publish_time_option()
foreach ($statuses as $status => $arr_status) {
$id = esc_attr($status) . '-display-publish-time';

echo '<div><label for="' . $id . '">';
if ($arr_status['for_revision'] && empty($in_revisions_section)) {
$style = 'margin-top: 30px;';
$in_revisions_section = true;
} else {
$style = '';
}

echo '<div style="' . esc_attr($style) . '"><label for="' . $id . '">';
echo '<input id="' . $id . '" name="' . $field_name . '[' . esc_attr($status) . ']"';

if (isset($this->module->options->show_posts_publish_time[$status])) {
Expand Down

0 comments on commit d586f54

Please sign in to comment.