Skip to content

Commit

Permalink
Merge pull request #5 from riha112/1392-3
Browse files Browse the repository at this point in the history
#1392 Added missing XML files
  • Loading branch information
alfredsgenkins authored Nov 13, 2020
2 parents e48f23d + b5380e4 commit 9131bbd
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/Controller/AppIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class AppIcon
const STORAGE_PATH = 'favicon/icons/';

const IMAGE_RESIZING_CONFIG = [
'apple' => [
'ios' => [
'type' => 'ios',
'sizes' => [120, 152, 167, 180, 1024]
],
'apple_startup' => [
'ios_startup' => [
'type' => 'ios_startup',
'sizes' => [2048, 1668, 1536, 1125, 1242, 750, 640]
],
Expand Down Expand Up @@ -119,18 +119,23 @@ public function getIconLinks ()
{
$output = [
'icon' => [],
'ios_startup' => []
'ios' => [],
'ios_startup' => [],
'android' => []
];

foreach (self::IMAGE_RESIZING_CONFIG as $type => $config) {
$targetPath = $type === 'apple_startup' ? 'ios_startup' : 'icon';
foreach ($config['sizes'] as $size) {
$width = is_array($size) ? $size[0] : $size;
$height = is_array($size) ? $size[1] : $size;
$size = $width . 'x' . $height;
$name = 'icon_' . $config['type'] . '_' . $width . 'x' . $height;
$href = 'pub/media/' . self::STORAGE_PATH . $name . '.png';
$output[$targetPath][$size] = [
$output[$type][$size] = [
'href' => $href,
'sizes' => $size
];
$output['icon'][$size] = [
'href' => $href,
'sizes' => $size
];
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Webmanifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Webmanifest
{
const WEBMANIFEST_CONFIG_PATH = 'webmanifest_customization/webmanifest/';

const STORAGE_PATH = 'webmanifest/manifest.webmanifest';
const STORAGE_PATH = 'webmanifest/manifest.json';

const ALLOWED_FIELDS = [
'name',
Expand Down
1 change: 1 addition & 0 deletions src/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="ScandiPWA\Locale\View\Result\Page" type="ScandiPWA\Customization\View\Result\Page" />
<preference for="Magento\Theme\Model\Design\Backend\Favicon" type="ScandiPWA\Customization\Model\Design\Backend\Favicon" />
</config>
34 changes: 34 additions & 0 deletions src/view/adminhtml/ui_component/design_config_form.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* @category ScandiPWA
* @package ScandiPWA\Customization
* @author Rihards Abolins <[email protected]>
* @copyright Copyright (c) 2015 Scandiweb, Ltd (http://scandiweb.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="other_settings" sortOrder="30">
<fieldset name="head">
<field name="head_shortcut_icon" formElement="imageUploader">
<settings>
<notice translate="true">File should be called "favicon"!</notice>
<label translate="true">Favicon Icon</label>
<componentType>imageUploader</componentType>
</settings>
<formElements>
<imageUploader>
<settings>
<allowedExtensions>png</allowedExtensions>
<maxFileSize>2097152</maxFileSize>
<uploaderConfig>
<param xsi:type="string" name="url">theme/design_config_fileUploader/save</param>
</uploaderConfig>
</settings>
</imageUploader>
</formElements>
</field>
</fieldset>
</fieldset>
</form>

0 comments on commit 9131bbd

Please sign in to comment.