diff --git a/projects/plugins/jetpack/changelog/update-copy-post-link-with-icon b/projects/plugins/jetpack/changelog/update-copy-post-link-with-icon new file mode 100644 index 0000000000000..be181abc9685d --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-copy-post-link-with-icon @@ -0,0 +1,4 @@ +Significance: minor +Type: other + +Copy Post: Add Jetpack Logo to row action link diff --git a/projects/plugins/jetpack/modules/copy-post.php b/projects/plugins/jetpack/modules/copy-post.php index c34c7b5576705..762fbcba41bd2 100644 --- a/projects/plugins/jetpack/modules/copy-post.php +++ b/projects/plugins/jetpack/modules/copy-post.php @@ -13,6 +13,8 @@ * @package automattic/jetpack */ +use Automattic\Jetpack\Assets\Logo; + // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files. /** @@ -28,6 +30,7 @@ class Jetpack_Copy_Post { */ public function __construct() { if ( 'edit.php' === $GLOBALS['pagenow'] ) { + add_action( 'admin_head', array( $this, 'print_inline_styles' ) ); add_filter( 'post_row_actions', array( $this, 'add_row_action' ), 10, 2 ); add_filter( 'page_row_actions', array( $this, 'add_row_action' ), 10, 2 ); return; @@ -39,6 +42,26 @@ public function __construct() { } } + /** + * Echos inline styles for the Jetpack logo. + * + * @return void + */ + public function print_inline_styles() { + echo ' + + '; + } + /** * Update the new (target) post data with the source post data. * @@ -308,19 +331,22 @@ public function add_row_action( $actions, $post ) { return $actions; } - $edit_url = add_query_arg( + $edit_url = add_query_arg( array( 'post_type' => $post->post_type, 'jetpack-copy' => $post->ID, ), admin_url( 'post-new.php' ) ); - $edit_action = array( + + $jetpack_logo = new Logo(); + $edit_action = array( 'jetpack-copy' => sprintf( - '%s', + '%3$s %4$s', esc_url( $edit_url ), - esc_attr__( 'Copy this post.', 'jetpack' ), - esc_html__( 'Copy', 'jetpack' ) + esc_attr__( 'Copy this post with Jetpack', 'jetpack' ), + esc_html__( 'Copy', 'jetpack' ), + $jetpack_logo->get_jp_emblem() ), );