| @@ -189,8 +189,26 @@ | ||
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | + * The admin menu mark: the same document-and-tick glyph as the plugin | |
| 194 | + * icon, monochrome so it follows WordPress' menu colour schemes. Falls | |
| 195 | + * back to a dashicon if the file is ever missing from the build. | |
| 196 | + * | |
| 197 | + * @return string Data URI, or a dashicon class. | |
| 198 | + */ | |
| 199 | + public static function menuIcon() { | |
| 200 | + static $icon = null; | |
| 201 | + if ($icon !== null) { | |
| 202 | + return $icon; | |
| 203 | + } | |
| 204 | + $file = EASY_INVOICE_PLUGIN_DIR . 'assets/images/menu-icon.svg'; | |
| 205 | + $svg = is_readable($file) ? file_get_contents($file) : ''; | |
| 206 | + $icon = $svg ? 'data:image/svg+xml;base64,' . base64_encode($svg) : 'dashicons-media-text'; | |
| 207 | + return $icon; | |
| 208 | + } | |
| 209 | + | |
| 210 | + /** | |
| 193 | 211 | * Register admin menu pages |
| 194 | 212 | */ |
| 195 | 213 | public function registerMenuPages() { |
| 196 | 214 | // Main menu item |
| @@ -199,9 +217,9 @@ | ||
| 199 | 217 | __('Easy Invoice', 'easy-invoice'), |
| 200 | 218 | $this->menuCapability(PagesSlugs::DASHBOARD), |
| 201 | 219 | PagesSlugs::DASHBOARD, |
| 202 | 220 | array($this, 'displayMainPage'), |
| 203 | - 'dashicons-media-text', | |
| 221 | + self::menuIcon(), | |
| 204 | 222 | 25 |
| 205 | 223 | ); |
| 206 | 224 | |
| 207 | 225 | // Dashboard submenu |