Skip to content

Commit

Permalink
Merge pull request #32 from 10up/enhancement/settings-link
Browse files Browse the repository at this point in the history
Link to Settings in plugin actions
  • Loading branch information
jeffpaul authored May 19, 2022
2 parents 16ea24c + 5a87b0a commit 7f01dcc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions includes/classes/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct() {
add_filter( 'sanitize_option_' . SETTINGS_GROUP, array( $this, 'sanitize' ), 10, 2 );

add_action( 'admin_menu', array( $this, 'logs_menu' ) );

add_filter( 'plugin_action_links_' . SOPHI_DEBUG_BAR_PLUGIN, array( $this, 'action_links' ) );

}

/**
Expand Down Expand Up @@ -244,4 +247,20 @@ public function sanitize( $value, $option ) {

return $value;
}

/**
* Add setting page to plugin action links.
*
* @param array $actions Plugin actions.
* @return array
*/
public function action_links( $actions = array() ) {
$links = array(
'<a href="' . admin_url( 'options-general.php?page=sophi' ) . '">' . __( 'Settings', 'debug-bar-for-sophi' ) . '</a>',
);

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

return $actions;
}
}
1 change: 1 addition & 0 deletions sophi-debug-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
define( 'SOPHI_DEBUG_BAR_VERSION', '0.2.0' );
define( 'SOPHI_DEBUG_BAR_URL', plugin_dir_url( __FILE__ ) );
define( 'SOPHI_DEBUG_BAR_PATH', plugin_dir_path( __FILE__ ) );
define( 'SOPHI_DEBUG_BAR_PLUGIN', plugin_basename( __FILE__ ) );
define( 'SOPHI_DEBUG_BAR_INC', SOPHI_DEBUG_BAR_PATH . 'includes/' );
$upload_dir = wp_upload_dir( null, false );
define( 'SOPHI_DEBUG_BAR_LOG_PATH', $upload_dir['basedir'] . '/sophi-logs' );
Expand Down

0 comments on commit 7f01dcc

Please sign in to comment.