Admin.php
1 month ago
AdminEnqueue.php
1 month ago
AdminHelp.php
1 month ago
AdminMenu.php
1 month ago
PluginActionLinks.php
3 months ago
SupportExport.php
2 months ago
AdminHelp.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | namespace OnlineOptimisation\EmailEncoderBundle\Admin; |
| 4 | |
| 5 | use OnlineOptimisation\EmailEncoderBundle\Traits\PluginHelper; |
| 6 | use WP_Screen; |
| 7 | |
| 8 | class AdminHelp |
| 9 | { |
| 10 | use PluginHelper; |
| 11 | |
| 12 | |
| 13 | // public function boot(): void { |
| 14 | // } |
| 15 | |
| 16 | |
| 17 | public function add_help_tabs(): void |
| 18 | { |
| 19 | // Help content is now rendered inline as the 'Help' panel inside our |
| 20 | // custom settings page. WP's top-right Help dropdown is removed to |
| 21 | // avoid duplication and to keep all plugin help in one place. |
| 22 | $screen = get_current_screen(); |
| 23 | if ( $screen === null ) { |
| 24 | return; |
| 25 | } |
| 26 | |
| 27 | // Remove the WP-default tabs that may have been registered by other |
| 28 | // sources (e.g. core's "Overview" tab on settings screens) so the |
| 29 | // Help dropdown disappears from the corner of the page. |
| 30 | foreach ( $screen->get_help_tabs() as $tab ) { |
| 31 | $screen->remove_help_tab( $tab['id'] ); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | |
| 36 | /** |
| 37 | * @param WP_Screen $screen |
| 38 | * @param array< string, string > $args |
| 39 | * @return void |
| 40 | */ |
| 41 | public function load_help_tabs( WP_Screen $screen, array $args ): void |
| 42 | { |
| 43 | if ( empty( $args['id'] ) ) { |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | $allowed_attr_html = $this->getSafeHtmlAttr(); |
| 48 | |
| 49 | include \EEB_PLUGIN_DIR . 'templates/help-tabs/' . $args['id'] . '.php'; |
| 50 | } |
| 51 | |
| 52 | |
| 53 | } |
| 54 |