diff --git a/modules/pwa_extras/config/install/pwa_extras.settings.yml b/modules/pwa_extras/config/install/pwa_extras.settings.yml index 2d7c89a..11de1e2 100644 --- a/modules/pwa_extras/config/install/pwa_extras.settings.yml +++ b/modules/pwa_extras/config/install/pwa_extras.settings.yml @@ -1,9 +1,6 @@ apple: touch_icons: - touch-icon-iphone: 0 - touch-icon-ipad: 0 - touch-icon-iphone-retina: 0 - touch-icon-ipad-retina: 0 + touch-icon-default: 0 meta_tags: meta-capable: 0 meta-status-bar-style: 0 diff --git a/modules/pwa_extras/pwa_extras.links.menu.yml b/modules/pwa_extras/pwa_extras.links.menu.yml index 318ba4c..88d59ec 100644 --- a/modules/pwa_extras/pwa_extras.links.menu.yml +++ b/modules/pwa_extras/pwa_extras.links.menu.yml @@ -1,5 +1,6 @@ pwa_extras.settings: title: PWA Extras Settings description: 'Progressive web app Extras configuration' - parent: system.admin_config_system + parent: pwa.admin_index route_name: pwa_extras.settings + weight: 1 \ No newline at end of file diff --git a/modules/pwa_extras/pwa_extras.module b/modules/pwa_extras/pwa_extras.module index 456a6b7..597189e 100644 --- a/modules/pwa_extras/pwa_extras.module +++ b/modules/pwa_extras/pwa_extras.module @@ -14,13 +14,15 @@ function pwa_extras_page_attachments(array &$attachments) { } $config = \Drupal::config('pwa_extras.settings.apple'); - $tag_list = pwa_extras_tag_list(); + $status_color = $config->get('color_select'); + $tag_list = pwa_extras_tag_list($status_color); - $meta_tags = $config->get('meta_tags'); + $meta_tags = $config->get('touch_icons') + $config->get('meta_tags') + $config->get('home_screen_icons'); if (empty($meta_tags)) return; - $meta_tags = explode(', ', $meta_tags); - foreach ($meta_tags as $key) { + foreach ($meta_tags as $key => $value) { + if (!$value) continue; + $string_tag = $tag_list[$key]; $dom = new DOMDocument; $dom->loadHTML($string_tag); @@ -45,26 +47,23 @@ function pwa_extras_page_attachments(array &$attachments) { } } -function pwa_extras_tag_list() { +function pwa_extras_tag_list($status_color) { $touch_icons = pwa_extras_apple_touch_icons(); - $meta_tags = pwa_extras_apple_meta_tags(); + $meta_tags = pwa_extras_apple_meta_tags($status_color); $homescreen_icons = pwa_extras_apple_home_screen_icons(); return array_merge($touch_icons, $meta_tags, $homescreen_icons); } function pwa_extras_apple_touch_icons() { return [ - 'touch-icon-iphone' => '', - 'touch-icon-ipad' => '', - 'touch-icon-iphone-retina' => '', - 'touch-icon-ipad-retina' => '', + 'touch-icon-default' => '', ]; } -function pwa_extras_apple_meta_tags() { +function pwa_extras_apple_meta_tags($status_color = '') { return [ 'meta-capable' => '', - 'meta-status-bar-style' => '', + 'meta-status-bar-style' => '', ]; }