Skip to content

Commit e2dca0b

Browse files
committed
Make edac_get_origin_url_for_virtual_page accept string as first param
This makes the pattern of sending string and returning string more clear, the id is still passed through as well to get the virtual url for it If no virtual url is found the original string is passed back, the original string is usually a permalink [PRO-169]
1 parent 4fc1925 commit e2dca0b

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

admin/class-ajax.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ function ( $a, $b ) {
493493

494494
$post_view_link = apply_filters(
495495
'edac_get_origin_url_for_virtual_page',
496+
get_the_permalink( $postid ),
496497
$postid
497498
);
498499

@@ -501,7 +502,7 @@ function ( $a, $b ) {
501502
'edac' => $id,
502503
'edac_nonce' => wp_create_nonce( 'edac_highlight' ),
503504
],
504-
is_string( $post_view_link ) ? $post_view_link : get_the_permalink( $postid )
505+
$post_view_link
505506
);
506507

507508
// Translators: %d is the issue ID.

admin/class-enqueue-admin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,15 @@ public static function maybe_enqueue_admin_and_editor_app_scripts() {
114114
} else {
115115
$post_view_link = apply_filters(
116116
'edac_get_origin_url_for_virtual_page',
117+
get_preview_post_link( $post_id ),
117118
$post_id
118119
);
119120

120121
$scan_url = add_query_arg(
121122
[
122123
'edac_pageScanner' => 1,
123124
],
124-
is_string( $post_view_link ) ? $post_view_link : get_preview_post_link( $post_id )
125+
$post_view_link
125126
);
126127
}
127128

includes/helper-functions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $
774774
if ( ! empty( $landmark_selector ) ) {
775775
$link = apply_filters(
776776
'edac_get_origin_url_for_virtual_page',
777+
get_the_permalink( $post_id ),
777778
$post_id
778779
);
779780

@@ -782,7 +783,7 @@ function edac_generate_landmark_link( $landmark, $landmark_selector, $post_id, $
782783
'edac_landmark' => base64_encode( $landmark_selector ),
783784
'edac_nonce' => wp_create_nonce( 'edac_highlight' ),
784785
],
785-
is_string( $link ) ? $link : get_the_permalink( $post_id )
786+
$link
786787
);
787788

788789
// translators: %s is the landmark type (e.g., "Header", "Navigation", "Main").

0 commit comments

Comments
 (0)