Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Add more information link to the plugin row meta
Browse files Browse the repository at this point in the history
  • Loading branch information
richtabor committed Jul 13, 2018
1 parent 8e5ac81 commit 76865ed
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions class-block-unit-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ private function __construct() {
add_action( 'admin_init', array( $this, 'create_block_unit_test_page' ) );
add_action( 'admin_init', array( $this, 'update_block_unit_test_page' ) );
add_action( 'upgrader_process_complete', array( $this, 'upgrade_completed' ), 10, 2 );

// Filters.
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
}

/**
Expand Down Expand Up @@ -1188,5 +1191,29 @@ public function content() {
}
return apply_filters( 'block_unit_test_content', $content );
}

/**
* Plugin row meta links
*
* @param array|array $input already defined meta links.
* @param string|string $file plugin file path and name being processed.
* @return array $input
*/
public function plugin_row_meta( $input, $file ) {

if ( 'block-unit-test/class-block-unit-test.php' !== $file ) {
return $input;
}

$url = 'https://richtabor.com/gutenberg-block-unit-test/';

$links = array(
'<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html__( 'More information', '@@textdomain' ) . '</a>',
);

$input = array_merge( $input, $links );

return $input;
}
}
Block_Unit_Test::register();

0 comments on commit 76865ed

Please sign in to comment.