settings: added/fixed link to settings in plugin page
This commit is contained in:
parent
098b1f578b
commit
d1088756c8
2 changed files with 18 additions and 4 deletions
|
@ -46,13 +46,26 @@ class Settings_Page {
|
||||||
'Activitypub Event Extension',
|
'Activitypub Event Extension',
|
||||||
'Activitypub Events',
|
'Activitypub Events',
|
||||||
'manage_options',
|
'manage_options',
|
||||||
'activitypub-events',
|
self::settings_slug,
|
||||||
array( self::static, 'settings_page' )
|
array( self::static, 'settings_page' )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds Link to the settings page in the plugin page.
|
||||||
|
* It's called via apply_filter('plugin_action_links_' . PLUGIN_NAME).
|
||||||
|
*
|
||||||
|
* @param links already added links
|
||||||
|
* @return array original links but with link to setting page added
|
||||||
|
*/
|
||||||
|
public static function settings_link( $links ) {
|
||||||
|
return array_merge(
|
||||||
|
$links,
|
||||||
|
array(
|
||||||
|
'<a href="' . admin_url( 'options-general.php?page=' . self::settings_slug ) . '">Settings</a>',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static function settings_page() {
|
public static function settings_page() {
|
||||||
if ( empty( $_GET['tab'] ) ) {
|
if ( empty( $_GET['tab'] ) ) {
|
||||||
|
|
|
@ -142,7 +142,8 @@ class Setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'admin_menu', array( Settings_Page::static, 'admin_menu' ) );
|
add_action( 'admin_menu', array( Settings_Page::static, 'admin_menu' ) );
|
||||||
add_filter( 'plugin_action_links_Activitypub_Event_Extensions', array( Settings_Page::static, 'settings_links' ) );
|
add_filter( 'plugin_action_links_' . ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_BASENAME,
|
||||||
|
array( Settings_Page::static, 'settings_link' ) );
|
||||||
|
|
||||||
add_filter( 'activitypub_transformer', array( $this, 'register_activitypub_event_transformer' ), 10, 3 );
|
add_filter( 'activitypub_transformer', array( $this, 'register_activitypub_event_transformer' ), 10, 3 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue