1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

add settings link to plugin on plugins page

This commit is contained in:
Daniel Waxweiler
2025-05-23 17:25:52 +02:00
parent 968de8889f
commit 95d18630ca
3 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#### Added #### Added
- Display "Show more events" button below the events list - Display "Show more events" button below the events list
- Document basic installation - Document basic installation
- Add settings link to plugin on plugins page
#### Changed #### Changed
#### Deprecated #### Deprecated
#### Removed #### Removed

View File

@ -37,6 +37,7 @@ final class Mobilizon_Connector {
add_action('init', [$this, 'register_shortcut']); add_action('init', [$this, 'register_shortcut']);
add_action('widgets_init', [$this, 'register_widget']); add_action('widgets_init', [$this, 'register_widget']);
register_activation_hook(__FILE__, [$this, 'enable_activation']); register_activation_hook(__FILE__, [$this, 'enable_activation']);
add_filter('plugin_action_links_connector-mobilizon/connector-mobilizon.php', [$this, 'add_settings_link_to_plugins_page']);
} }
public static function init() { public static function init() {
@ -48,6 +49,19 @@ final class Mobilizon_Connector {
return $instance; return $instance;
} }
public function add_settings_link_to_plugins_page(array $links) {
$url = esc_url(
add_query_arg(
'page',
'connector-mobilizon-settings',
get_admin_url() . 'options-general.php'
)
);
$settings_link = "<a href='$url'>" . __('Settings') . '</a>';
array_unshift($links, $settings_link);
return $links;
}
public function enable_activation() { public function enable_activation() {
MobilizonConnector\Settings::setDefaultOptions(); MobilizonConnector\Settings::setDefaultOptions();
} }

View File

@ -33,7 +33,6 @@ Install this plugin on the "Add Plugin" page in the administrator backend of you
In both cases, you then need to click the corresponding "Install now" button. In both cases, you then need to click the corresponding "Install now" button.
After the installation, you can adapt the URL of the Mobilizon instance whose events you want to list on the plugin's settings' page. After the installation, you can adapt the URL of the Mobilizon instance whose events you want to list on the plugin's settings' page.
Access it by clicking "Settings" and then "Connector for Mobilizon".
### Shortcut usage ### Shortcut usage