Admin.php
5 months ago
AdminEnqueue.php
5 months ago
AdminHelp.php
5 months ago
AdminMenu.php
5 months ago
AdminMetaBox.php
5 months ago
PluginActionLinks.php
5 months ago
AdminHelp.php
53 lines
| 1 | <?php |
| 2 | |
| 3 | namespace OnlineOptimisation\EmailEncoderBundle\Admin; |
| 4 | |
| 5 | use OnlineOptimisation\EmailEncoderBundle\Traits\PluginHelper; |
| 6 | |
| 7 | class AdminHelp |
| 8 | { |
| 9 | use PluginHelper; |
| 10 | |
| 11 | |
| 12 | // public function boot(): void { |
| 13 | // } |
| 14 | |
| 15 | |
| 16 | public function add_help_tabs(): void |
| 17 | { |
| 18 | $screen = get_current_screen(); |
| 19 | |
| 20 | $defaults = [ |
| 21 | 'content' => '', |
| 22 | 'callback' => [ $this, 'load_help_tabs' ], |
| 23 | ]; |
| 24 | |
| 25 | $tabs = [ |
| 26 | [ 'id' => 'general', 'title' => 'General' ], |
| 27 | [ 'id' => 'shortcodes', 'title' => 'Shortcodes' ], |
| 28 | [ 'id' => 'template-tags', 'title' => 'Template Tags' ], |
| 29 | ]; |
| 30 | |
| 31 | foreach ( $tabs as $tab ) { |
| 32 | $screen->add_help_tab( wp_parse_args( [ |
| 33 | 'id' => $tab['id'], |
| 34 | 'title' => __( $tab['title'], 'email-encoder-bundle' ), |
| 35 | ], $defaults ) ); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | |
| 40 | public function load_help_tabs( \WP_Screen $screen, array $args ): void |
| 41 | { |
| 42 | if ( empty( $args['id'] ) ) { |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | $allowed_attr_html = $this->getSafeHtmlAttr(); |
| 47 | |
| 48 | include \EEB_PLUGIN_DIR . 'templates/help-tabs/' . $args['id'] . '.php'; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | } |
| 53 |