class-activation.php
3 years ago
class-admin-interface.php
3 years ago
class-content-management.php
3 years ago
class-deactivation.php
3 years ago
class-admin-interface.php
74 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ASENHA\Classes; |
| 4 | use WP_Admin_Bar; |
| 5 | |
| 6 | /** |
| 7 | * Class related to Admin Interface functionalities |
| 8 | * |
| 9 | * @since 1.2.0 |
| 10 | */ |
| 11 | class Admin_Interface { |
| 12 | |
| 13 | /** |
| 14 | * Wrapper for admin notices being output on admin screens |
| 15 | * |
| 16 | * @since 1.2.0 |
| 17 | */ |
| 18 | public function admin_notices_wrapper() { |
| 19 | |
| 20 | echo '<div class="asenha-admin-notices-drawer" style="display:none;"><h2>Admin Notices</h2></div>'; |
| 21 | |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Admin bar menu item for the hidden admin notices |
| 26 | * |
| 27 | * @link https://developer.wordpress.org/reference/classes/wp_admin_bar/add_menu/ |
| 28 | * @link https://developer.wordpress.org/reference/classes/wp_admin_bar/add_node/ |
| 29 | * @since 1.2.0 |
| 30 | */ |
| 31 | public function admin_notices_menu( WP_Admin_Bar $wp_admin_bar ) { |
| 32 | |
| 33 | $wp_admin_bar->add_menu( array( |
| 34 | 'id' => 'asenha-hide-admin-notices', |
| 35 | 'parent' => 'top-secondary', |
| 36 | 'grou' => null, |
| 37 | 'title' => 'Notices<span class="asenha-admin-notices-counter" style="opacity:0;">0</span>', |
| 38 | // 'href' => '', |
| 39 | 'meta' => array( |
| 40 | 'class' => 'asenha-admin-notices-menu', |
| 41 | 'title' => 'Click to view hidden admin notices', |
| 42 | ), |
| 43 | ) ); |
| 44 | |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Inline CSS for the admin bar notices menu |
| 49 | * |
| 50 | * @since 1.2.0 |
| 51 | */ |
| 52 | public function admin_notices_menu_inline_css() { |
| 53 | |
| 54 | wp_add_inline_style( 'admin-bar', ' |
| 55 | |
| 56 | #wpadminbar .asenha-admin-notices-counter { |
| 57 | box-sizing: border-box; |
| 58 | margin: 1px 0 -1px 6px ; |
| 59 | padding: 2px 6px 3px 5px; |
| 60 | min-width: 18px; |
| 61 | height: 18px; |
| 62 | border-radius: 50%; |
| 63 | background-color: #ca4a1f; |
| 64 | color: #fff; |
| 65 | font-size: 11px; |
| 66 | line-height: 1.6; |
| 67 | text-align: center; |
| 68 | } |
| 69 | |
| 70 | ' ); |
| 71 | |
| 72 | } |
| 73 | |
| 74 | } |