Skip to content

Commit

Permalink
provide backward compatibility for people who do not have a shortcut …
Browse files Browse the repository at this point in the history
…section in their config
  • Loading branch information
Umfi authored and silviolleite committed Aug 20, 2020
1 parent 33157d4 commit 9acc2ef
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions Services/ManifestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,29 @@ public function generate()
];
}

foreach (config('laravelpwa.manifest.shortcuts') as $shortcut) {
if (config('laravelpwa.manifest.shortcuts')) {
foreach (config('laravelpwa.manifest.shortcuts') as $shortcut) {

if (array_key_exists("icons", $shortcut)) {
$fileInfo = pathinfo($shortcut['icons']['src']);
$icon = [
'src' => $shortcut['icons']['src'],
'type' => 'image/' . $fileInfo['extension'],
'purpose' => $shortcut['icons']['purpose']
];
} else {
$icon = [];
}
if (array_key_exists("icons", $shortcut)) {
$fileInfo = pathinfo($shortcut['icons']['src']);
$icon = [
'src' => $shortcut['icons']['src'],
'type' => 'image/' . $fileInfo['extension'],
'purpose' => $shortcut['icons']['purpose']
];
} else {
$icon = [];
}

$basicManifest['shortcuts'][] = [
'name' => trans($shortcut['name']),
'description' => trans($shortcut['description']),
'url' => $shortcut['url'],
'icons' => [
$basicManifest['shortcuts'][] = [
'name' => trans($shortcut['name']),
'description' => trans($shortcut['description']),
'url' => $shortcut['url'],
'icons' => [
$icon
]
];
];
}
}

foreach (config('laravelpwa.manifest.custom') as $tag => $value) {
Expand Down

0 comments on commit 9acc2ef

Please sign in to comment.