Skip to content

Commit 452dc2f

Browse files
authoredApr 15, 2024··
Add job overlay to admin (#2804)
1 parent 4175f4f commit 452dc2f

13 files changed

+236
-111
lines changed
 

‎.psalm/psalm-baseline.xml

-4
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@
7474
<code>WP_Job_manager</code>
7575
<code>WP_Job_manager</code>
7676
</InvalidClass>
77-
<ParadoxicalCondition>
78-
<code><![CDATA[! defined( 'ABSPATH' )]]></code>
79-
</ParadoxicalCondition>
8077
</file>
8178
<file src="includes/admin/class-wp-job-manager-cpt.php">
8279
<InvalidArgument>
@@ -219,7 +216,6 @@
219216
<file src="includes/class-wp-job-manager-post-types.php">
220217
<InvalidArgument>
221218
<code>$job_data</code>
222-
<code>$pending_jobs</code>
223219
<code><![CDATA[[
224220
apply_filters(
225221
'register_post_type_job_guest_user',

‎assets/css/admin.scss

+6
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ a.wpjm-activate-license-link:active {
9999
}
100100
}
101101

102+
.column-stats {
103+
a {
104+
display: block;
105+
}
106+
}
107+
102108
/** Promote Job Modal **/
103109
.promote-buttons-group {
104110
.button {

‎assets/css/job-overlay.scss

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
flex-wrap: wrap;
8080
}
8181

82+
&:empty {
83+
display: none;
84+
}
85+
8286
}
8387

8488
.jm-job-overlay-details-box {

‎assets/js/job-dashboard.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ async function showOverlay( eventOrId ) {
3030
eventOrId.preventDefault?.();
3131
overlayDialog.showModal();
3232

33-
const id = eventOrId.target?.dataset.jobId ?? eventOrId;
33+
const dashboardRowId = eventOrId.target?.dataset.jobId;
34+
const adminRowId = eventOrId.target?.closest( 'tr' )?.id?.replace( 'post-', '' );
35+
36+
const id = dashboardRowId ?? adminRowId ?? eventOrId;
3437

3538
if ( ! id ) {
3639
return;
@@ -42,7 +45,7 @@ async function showOverlay( eventOrId ) {
4245
contentElement.innerHTML = '<a class="jm-ui-spinner"></a>';
4346

4447
try {
45-
const response = await fetch( `${ overlayEndpoint }?job_id=${ id }` );
48+
const response = await fetch( `${ overlayEndpoint }&job_id=${ id }` );
4649

4750
if ( ! response.ok ) {
4851
throw new Error( response.statusText );
@@ -56,7 +59,7 @@ async function showOverlay( eventOrId ) {
5659
}
5760

5861
const clearHash = () => {
59-
history.replaceState( null, '', window.location.pathname );
62+
history.replaceState( null, '', window.location.pathname + window.location.search );
6063
overlayDialog.removeEventListener( 'close', clearHash );
6164
};
6265

@@ -67,7 +70,7 @@ async function showOverlay( eventOrId ) {
6770

6871
function setupStatsOverlay() {
6972
document
70-
.querySelectorAll( '.jm-dashboard-job .job-title' )
73+
.querySelectorAll( '.jm-dashboard-job .job-title, tr.job_listing td.column-stats' )
7174
.forEach( el => el.addEventListener( 'click', showOverlay ) );
7275

7376
const urlHash = window.location.hash?.substring( 1 );

‎includes/admin/class-wp-job-manager-admin.php

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* @package wp-job-manager
66
*/
77

8+
use WP_Job_Manager\Job_Overlay;
9+
810
if ( ! defined( 'ABSPATH' ) ) {
911
exit;
1012
}
@@ -64,6 +66,7 @@ public function __construct() {
6466

6567
$this->settings_page = WP_Job_Manager_Settings::instance();
6668
WP_Job_Manager_Addons_Landing_Page::instance();
69+
Job_Overlay::instance();
6770

6871
add_action( 'admin_init', [ $this, 'admin_init' ] );
6972
add_action( 'current_screen', [ $this, 'conditional_includes' ] );

‎includes/admin/class-wp-job-manager-cpt.php

+45-34
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public function approve_job() {
263263
'post_status' => 'publish',
264264
];
265265
wp_update_post( $job_data );
266-
wp_safe_redirect( remove_query_arg( 'approve_job', add_query_arg( 'handled_jobs', $post_id, add_query_arg( 'action_performed', 'approve_jobs', admin_url( 'edit.php?post_type=job_listing' ) ) ) ) );
266+
wp_safe_redirect( remove_query_arg( 'approve_job', add_query_arg( [ 'handled_jobs' => [ $post_id ] ], add_query_arg( 'action_performed', 'approve_jobs', admin_url( 'edit.php?post_type=job_listing' ) ) ) ) );
267267
exit;
268268
}
269269
}
@@ -545,39 +545,7 @@ public function row_actions( $actions, $post ) {
545545
unset( $actions['inline hide-if-no-js'] );
546546
unset( $actions['trash'] );
547547

548-
$admin_actions = [];
549-
550-
if ( in_array( $post->post_status, [ 'pending', 'pending_payment' ], true ) && current_user_can( 'publish_post', $post->ID ) ) {
551-
$admin_actions['approve'] = [
552-
'action' => 'approved',
553-
'name' => __( 'Approve', 'wp-job-manager' ),
554-
'url' => wp_nonce_url( add_query_arg( 'approve_job', $post->ID ), 'approve_job' ),
555-
];
556-
}
557-
if ( 'trash' !== $post->post_status ) {
558-
if ( current_user_can( 'read_post', $post->ID ) ) {
559-
$admin_actions['view'] = [
560-
'action' => 'view',
561-
'name' => __( 'View', 'wp-job-manager' ),
562-
'url' => get_permalink( $post->ID ),
563-
];
564-
}
565-
if ( current_user_can( 'edit_post', $post->ID ) ) {
566-
$admin_actions['edit'] = [
567-
'action' => 'edit',
568-
'name' => __( 'Edit', 'wp-job-manager' ),
569-
'url' => get_edit_post_link( $post->ID ),
570-
];
571-
}
572-
if ( current_user_can( 'delete_post', $post->ID ) ) {
573-
$admin_actions['delete'] = [
574-
'action' => 'delete',
575-
'name' => __( 'Delete', 'wp-job-manager' ),
576-
'url' => get_delete_post_link( $post->ID ),
577-
];
578-
}
579-
}
580-
$admin_actions = apply_filters( 'job_manager_admin_actions', $admin_actions, $post );
548+
$admin_actions = $this->get_admin_actions( $post );
581549

582550
foreach ( $admin_actions as $action ) {
583551
$actions[ $action['action'] ] = '<a href="' . esc_url( $action['url'] ) . '" title="" rel="permalink">' . esc_html( $action['name'] ) . '</a>';
@@ -587,6 +555,49 @@ public function row_actions( $actions, $post ) {
587555
return $actions;
588556
}
589557

558+
/**
559+
* Get the admin actions for a job listing.
560+
*
561+
* @param \WP_Post $post
562+
*
563+
* @return array
564+
*/
565+
public function get_admin_actions( $post ) {
566+
$admin_actions = [];
567+
568+
if ( in_array( $post->post_status, [ 'pending', 'pending_payment' ], true ) && current_user_can( 'publish_post', $post->ID ) ) {
569+
$admin_actions['approve'] = [
570+
'action' => 'approved',
571+
'name' => __( 'Approve', 'wp-job-manager' ),
572+
'url' => wp_nonce_url( add_query_arg( 'approve_job', $post->ID ), 'approve_job' ),
573+
];
574+
}
575+
if ( 'trash' !== $post->post_status ) {
576+
if ( current_user_can( 'read_post', $post->ID ) ) {
577+
$admin_actions['view'] = [
578+
'action' => 'view',
579+
'name' => __( 'View', 'wp-job-manager' ),
580+
'url' => get_permalink( $post->ID ),
581+
];
582+
}
583+
if ( current_user_can( 'edit_post', $post->ID ) ) {
584+
$admin_actions['edit'] = [
585+
'action' => 'edit',
586+
'name' => __( 'Edit', 'wp-job-manager' ),
587+
'url' => get_edit_post_link( $post->ID ),
588+
];
589+
}
590+
if ( current_user_can( 'delete_post', $post->ID ) ) {
591+
$admin_actions['delete'] = [
592+
'action' => 'delete',
593+
'name' => __( 'Delete', 'wp-job-manager' ),
594+
'url' => get_delete_post_link( $post->ID ),
595+
];
596+
}
597+
}
598+
return apply_filters( 'job_manager_admin_actions', $admin_actions, $post );
599+
}
600+
590601
/**
591602
* Displays the content for each custom column on the admin list for Job Listings.
592603
*

‎includes/class-job-dashboard-shortcode.php

+38-11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace WP_Job_Manager;
99

1010
use WP_Job_Manager\UI\Notice;
11+
use WP_Job_Manager\UI\Redirect_Message;
1112
use WP_Job_Manager\UI\UI_Elements;
1213

1314
if ( ! defined( 'ABSPATH' ) ) {
@@ -100,9 +101,7 @@ public function output_job_dashboard( $attrs ) {
100101
);
101102
$posts_per_page = $attrs['posts_per_page'];
102103

103-
\WP_Job_Manager::register_style( 'wp-job-manager-job-dashboard', 'css/job-dashboard.css', [ 'wp-job-manager-ui' ] );
104-
wp_enqueue_style( 'wp-job-manager-job-dashboard' );
105-
wp_enqueue_script( 'wp-job-manager-job-dashboard' );
104+
Job_Overlay::instance()->init_dashboard_overlay();
106105

107106
ob_start();
108107

@@ -134,7 +133,12 @@ public function output_job_dashboard( $attrs ) {
134133
// Cache IDs for access check later on.
135134
$this->job_dashboard_job_ids = wp_list_pluck( $jobs->posts, 'ID' );
136135

137-
echo '<div class="alignwide">' . wp_kses_post( $this->job_dashboard_message ) . '</div>';
136+
$message = Redirect_Message::get_message( 'updated' );
137+
138+
if ( ! empty( $message ) ) {
139+
//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in the notice class.
140+
echo '<div class="alignwide">' . $message . '</div>';
141+
}
138142

139143
$job_dashboard_columns = apply_filters(
140144
'job_manager_job_dashboard_columns',
@@ -160,6 +164,8 @@ public function output_job_dashboard( $attrs ) {
160164
]
161165
);
162166

167+
do_action( 'job_manager_job_dashboard', $jobs );
168+
163169
return ob_get_clean();
164170
}
165171

@@ -171,18 +177,16 @@ public function output_job_dashboard( $attrs ) {
171177
* @return array
172178
*/
173179
public function get_job_actions( $job ) {
174-
if (
175-
! get_current_user_id()
176-
|| ! $job instanceof \WP_Post
177-
|| \WP_Job_Manager_Post_Types::PT_LISTING !== $job->post_type
178-
|| ! $this->is_job_available_on_dashboard( $job )
179-
) {
180+
if ( ! $this->can_manage_job( $job ) ) {
180181
return [];
181182
}
182183

184+
$base_url = self::get_job_dashboard_page_url();
185+
183186
$base_nonce_action_name = 'job_manager_my_job_actions';
184187

185188
$actions = [];
189+
186190
switch ( $job->post_status ) {
187191
case 'publish':
188192
if ( \WP_Job_Manager_Post_Types::job_is_editable( $job->ID ) ) {
@@ -262,7 +266,7 @@ public function get_job_actions( $job ) {
262266

263267
// For backwards compatibility, convert `nonce => true` to the nonce action name.
264268
foreach ( $actions as $key => &$action ) {
265-
if ( true === $action['nonce'] ) {
269+
if ( isset( $action['nonce'] ) && true === $action['nonce'] ) {
266270
$action['nonce'] = $base_nonce_action_name;
267271
}
268272

@@ -510,6 +514,8 @@ public function handle_actions() {
510514
$this->job_dashboard_message = Notice::error( $e->getMessage() );
511515
}
512516

517+
Redirect_Message::redirect( remove_query_arg( [ 'action', 'job_id', '_wpnonce' ] ), $this->job_dashboard_message, 'updated' );
518+
513519
}
514520

515521
/**
@@ -665,6 +671,27 @@ public static function get_job_dashboard_page_url() {
665671
}
666672
}
667673

674+
/**
675+
* Check if the current user can manage this job listing.
676+
*
677+
* @param \WP_Post|null $job
678+
*
679+
* @return bool
680+
*/
681+
public function can_manage_job( $job ) {
682+
683+
if ( ! get_current_user_id()
684+
|| empty( $job )
685+
|| ! $job instanceof \WP_Post
686+
|| \WP_Job_Manager_Post_Types::PT_LISTING !== $job->post_type ) {
687+
return false;
688+
}
689+
690+
return is_admin()
691+
? current_user_can( \WP_Job_Manager_Post_Types::CAP_MANAGE_LISTINGS, $job->ID )
692+
: $this->is_job_available_on_dashboard( $job );
693+
}
694+
668695
/**
669696
* Check if a job is listed on the current user's job dashboard page.
670697
*

‎includes/class-job-overlay.php

+121-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
use WP_Job_Manager\UI\Modal_Dialog;
1111
use WP_Job_Manager\UI\Notice;
12+
use WP_Job_Manager\UI\UI;
13+
use WP_Job_Manager\UI\UI_Elements;
1214

1315
if ( ! defined( 'ABSPATH' ) ) {
1416
exit;
@@ -28,21 +30,39 @@ class Job_Overlay {
2830
*/
2931
public function __construct() {
3032
add_action( 'job_manager_ajax_job_dashboard_overlay', [ $this, 'ajax_job_overlay' ] );
33+
add_action( 'wp_ajax_job_dashboard_overlay', [ $this, 'ajax_job_overlay' ] );
34+
add_action( 'admin_footer', [ $this, 'init_admin_dashboard_overlay' ], 10 );
35+
add_action( 'job_manager_job_dashboard', [ $this, 'init_dashboard_overlay' ], 10 );
36+
add_action( 'job_manager_job_overlay_footer', [ $this, 'output_footer_actions' ], 10 );
3137

3238
}
3339

3440
/**
3541
* Render the job dashboard overlay content for an AJAX request.
3642
*/
3743
public function ajax_job_overlay() {
38-
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
44+
45+
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Nonce check.
46+
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'job_dashboard_overlay' ) ) {
47+
wp_send_json_error(
48+
Notice::error(
49+
[
50+
'message' => __( 'Invalid request.', 'wp-job-manager' ),
51+
'classes' => [ 'type-dialog' ],
52+
]
53+
)
54+
);
55+
56+
return;
57+
}
58+
3959
$job_id = isset( $_REQUEST['job_id'] ) ? absint( $_REQUEST['job_id'] ) : null;
4060

4161
$job = $job_id ? get_post( $job_id ) : null;
4262

4363
$shortcode = Job_Dashboard_Shortcode::instance();
4464

45-
if ( empty( $job ) || ! $shortcode->is_job_available_on_dashboard( $job ) ) {
65+
if ( ! $shortcode->can_manage_job( $job ) ) {
4666
wp_send_json_error(
4767
Notice::error(
4868
[
@@ -55,7 +75,7 @@ public function ajax_job_overlay() {
5575
return;
5676
}
5777

58-
$content = $this->get_job_overlay( $job );
78+
$content = $this->render_job_overlay( $job );
5979

6080
wp_send_json_success( $content );
6181

@@ -65,6 +85,11 @@ public function ajax_job_overlay() {
6585
* Output the modal element.
6686
*/
6787
public function output_modal_element() {
88+
89+
UI::instance()->enqueue_styles();
90+
wp_enqueue_style( 'wp-job-manager-job-dashboard' );
91+
wp_enqueue_script( 'wp-job-manager-job-dashboard' );
92+
6893
$overlay = new Modal_Dialog(
6994
[
7095
'id' => 'jmDashboardOverlay',
@@ -83,17 +108,14 @@ public function output_modal_element() {
83108
*
84109
* @return string
85110
*/
86-
private function get_job_overlay( $job ) {
87-
88-
$job_actions = Job_Dashboard_Shortcode::instance()->get_job_actions( $job );
111+
private function render_job_overlay( $job ) {
89112

90113
ob_start();
91114

92115
get_job_manager_template(
93116
'job-dashboard-overlay.php',
94117
[
95-
'job' => $job,
96-
'job_actions' => $job_actions,
118+
'job' => $job,
97119
]
98120
);
99121

@@ -102,5 +124,96 @@ private function get_job_overlay( $job ) {
102124
return $content;
103125
}
104126

127+
/**
128+
* Load and output overlay dependencies on the job listings screen.
129+
*
130+
* @output Modal HTML.
131+
*
132+
* @return void
133+
*/
134+
public function init_admin_dashboard_overlay() {
135+
$screen = get_current_screen();
136+
137+
if ( ! $screen || 'edit-job_listing' !== $screen->id ) {
138+
return;
139+
}
140+
141+
$this->init_dashboard_overlay();
142+
}
143+
144+
/**
145+
* Load scripts and output HTML skeleton for the job dashboard overlay.
146+
*
147+
* @output Modal HTML.
148+
*
149+
* @return void
150+
*/
151+
public function init_dashboard_overlay() {
152+
153+
\WP_Job_Manager::register_script( 'wp-job-manager-job-dashboard', 'js/job-dashboard.js', null, true );
154+
\WP_Job_Manager::register_style( 'wp-job-manager-job-dashboard', 'css/job-dashboard.css', [ 'wp-job-manager-ui' ] );
155+
156+
$endpoint = is_admin()
157+
? add_query_arg( [ 'action' => 'job_dashboard_overlay' ], admin_url( 'admin-ajax.php' ) )
158+
: \WP_Job_Manager_Ajax::get_endpoint( 'job_dashboard_overlay' );
159+
$endpoint = wp_nonce_url( $endpoint, 'job_dashboard_overlay' );
160+
161+
wp_localize_script(
162+
'wp-job-manager-job-dashboard',
163+
'job_manager_job_dashboard',
164+
[
165+
'i18nConfirmDelete' => esc_html__( 'Are you sure you want to delete this listing?', 'wp-job-manager' ),
166+
'overlayEndpoint' => $endpoint,
167+
'statsEnabled' => \WP_Job_Manager\Stats::is_enabled(),
168+
]
169+
);
170+
171+
$this->output_modal_element();
172+
}
173+
174+
/**
175+
* Output the job actions in the overlay footer.
176+
*
177+
* @param \WP_Post $job
178+
*/
179+
public function output_footer_actions( $job ) {
180+
181+
if ( is_admin() ) {
182+
return;
183+
}
184+
185+
$job_actions = Job_Dashboard_Shortcode::instance()->get_job_actions( $job );
186+
187+
$buttons = [];
188+
$actions = [];
189+
if ( ! empty( $job_actions ) ) {
190+
$primary = Job_Dashboard_Shortcode::get_primary_action( $job, $job_actions );
191+
192+
if ( $primary ) {
193+
$buttons[] = [
194+
'label' => $primary['label'],
195+
'url' => $primary['url'],
196+
'class' => 'job-dashboard-action-' . esc_attr( $primary['name'] ),
197+
'primary' => false,
198+
];
199+
}
200+
201+
foreach ( $job_actions as $action ) {
202+
if ( ! empty( $primary ) && $primary['name'] === $action['name'] ) {
203+
continue;
204+
}
205+
$actions[] = [
206+
'label' => $action['label'],
207+
'url' => $action['url'],
208+
'class' => 'job-dashboard-action-' . esc_attr( $action['name'] ),
209+
];
210+
}
211+
}
212+
213+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in UI classes.
214+
echo UI_Elements::actions( $buttons, $actions );
215+
216+
}
217+
105218

106219
}

‎includes/class-stats-dashboard.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ private function __construct() {
3535
add_filter( 'job_manager_job_dashboard_columns', [ $this, 'add_stats_column' ] );
3636
add_action( 'job_manager_job_dashboard_column_' . self::COLUMN_NAME, [ $this, 'render_stats_column' ] );
3737

38-
add_filter( 'manage_edit-job_listing_columns', [ $this, 'add_stats_column' ], 20 );
39-
add_action( 'manage_job_listing_posts_custom_column', [ $this, 'maybe_render_job_listing_posts_custom_column' ], 2 );
38+
add_filter( 'manage_edit-job_listing_columns', [ $this, 'add_stats_column' ] );
39+
add_action( 'manage_job_listing_posts_custom_column', [ $this, 'maybe_render_admin_stats_column' ], 2 );
4040

4141
add_action( 'job_manager_job_overlay_content', [ $this, 'output_job_stats' ], 12 );
4242
}
@@ -77,11 +77,13 @@ public function render_stats_column( $job ) {
7777
*
7878
* @param string $column
7979
*/
80-
public function maybe_render_job_listing_posts_custom_column( $column ) {
80+
public function maybe_render_admin_stats_column( $column ) {
8181
global $post;
8282

83-
if ( self::COLUMN_NAME === $column ) {
83+
if ( self::COLUMN_NAME === $column && ! empty( $post->ID ) ) {
84+
echo '<a href="#' . esc_attr( $post->ID ) . ' ">';
8485
$this->render_stats_column( $post );
86+
echo '</a>';
8587
}
8688
}
8789

‎includes/class-wp-job-manager.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* @since 1.33.0
77
*/
88

9+
use WP_Job_Manager\Job_Overlay;
10+
911
if ( ! defined( 'ABSPATH' ) ) {
1012
exit;
1113
}
@@ -540,7 +542,6 @@ public function frontend_scripts() {
540542

541543
wp_register_script( 'jquery-deserialize', JOB_MANAGER_PLUGIN_URL . '/assets/lib/jquery-deserialize/jquery.deserialize.js', [ 'jquery' ], '1.2.1', true );
542544
self::register_script( 'wp-job-manager-ajax-filters', 'js/ajax-filters.js', $ajax_filter_deps, true );
543-
self::register_script( 'wp-job-manager-job-dashboard', 'js/job-dashboard.js', null, true );
544545
self::register_script( 'wp-job-manager-job-application', 'js/job-application.js', [ 'jquery' ], true );
545546
self::register_script( 'wp-job-manager-job-submission', 'js/job-submission.js', [ 'jquery' ], true );
546547
wp_localize_script( 'wp-job-manager-ajax-filters', 'job_manager_ajax_filters', $ajax_data );
@@ -571,15 +572,7 @@ public function frontend_scripts() {
571572
]
572573
);
573574

574-
wp_localize_script(
575-
'wp-job-manager-job-dashboard',
576-
'job_manager_job_dashboard',
577-
[
578-
'i18nConfirmDelete' => esc_html__( 'Are you sure you want to delete this listing?', 'wp-job-manager' ),
579-
'overlayEndpoint' => WP_Job_Manager_Ajax::get_endpoint( 'job_dashboard_overlay' ),
580-
'statsEnabled' => \WP_Job_Manager\Stats::is_enabled(),
581-
]
582-
);
575+
Job_Overlay::instance()->init_dashboard_overlay();
583576

584577
wp_localize_script(
585578
'wp-job-manager-job-submission',

‎psalm.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
<referencedClass name="WP_CLI" />
3030
</errorLevel>
3131
</UndefinedClass>
32-
<InvalidScalarArgument>
32+
<InvalidArgument>
3333
<errorLevel type="suppress">
3434
<referencedFunction name="esc_attr" />
3535
</errorLevel>
36-
</InvalidScalarArgument>
36+
</InvalidArgument>
3737
</issueHandlers>
3838
<stubs>
3939
<file name="wp-job-manager.php" />

‎templates/job-dashboard-overlay.php

+1-32
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* @version $$next-version$$
1010
*
1111
* @var WP_Post $job Array of job post results.
12-
* @var array $job_actions
1312
*/
1413

1514
use WP_Job_Manager\Job_Dashboard_Shortcode;
@@ -58,35 +57,5 @@
5857
<?php do_action( 'job_manager_job_overlay_content', $job ); ?>
5958

6059
</div>
61-
<div class="jm-job-overlay-footer">
62-
<?php
63-
$buttons = [];
64-
$actions = [];
65-
if ( ! empty( $job_actions ) ) {
66-
$primary = Job_Dashboard_Shortcode::get_primary_action( $job, $job_actions );
67-
68-
if ( $primary ) {
69-
$buttons[] = [
70-
'label' => $primary['label'],
71-
'url' => $primary['url'],
72-
'class' => 'job-dashboard-action-' . esc_attr( $primary['name'] ),
73-
'primary' => false,
74-
];
75-
}
76-
77-
foreach ( $job_actions as $action ) {
78-
if ( ! empty( $primary ) && $primary['name'] === $action['name'] ) {
79-
continue;
80-
}
81-
$actions[] = [
82-
'label' => $action['label'],
83-
'url' => $action['url'],
84-
'class' => 'job-dashboard-action-' . esc_attr( $action['name'] ),
85-
];
86-
}
87-
}
88-
89-
echo UI_Elements::actions( $buttons, $actions );
90-
?>
91-
</div>
60+
<div class="jm-job-overlay-footer"><?php do_action( 'job_manager_job_overlay_footer', $job ); ?></div>
9261
</div>

‎templates/job-dashboard.php

-2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,4 @@ class="jm-dashboard-job-column <?php echo esc_attr( $key ); ?>"><?php echo esc_h
100100
<?php endif; ?>
101101
</div>
102102
<?php get_job_manager_template( 'pagination.php', [ 'max_num_pages' => $max_num_pages ] ); ?>
103-
104-
<?php Job_Overlay::instance()->output_modal_element(); ?>
105103
</div>

0 commit comments

Comments
 (0)
Please sign in to comment.