From 253fe9ea43448bda4eb25c305436d2b7bfa50a0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20B=C3=A9jean?= <nicolas@bejean.eu>
Date: Fri, 8 May 2020 16:57:48 +0200
Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20de=20la=20configuration=20et=20?=
 =?UTF-8?q?des=20param=C3=A8tres=20par=20d=C3=A9faut?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 etc/adminhtml/system.xml | 58 ++++++++++++++++++++++++++++++++++++++++
 etc/config.xml           | 21 +++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 etc/adminhtml/system.xml
 create mode 100644 etc/config.xml

diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
new file mode 100644
index 0000000..208c814
--- /dev/null
+++ b/etc/adminhtml/system.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
+    <system>
+        <section id="categorywidget" translate="label" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
+            <class>separator-top</class>
+            <label>Image Slider Manager</label>
+            <tab>nicolasbejean</tab>
+            <resource>NicolasBejean_CategoryWidget::global</resource>
+            <group id="resize" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
+                <label>Image Resize Settings</label>
+                <comment>Default Resize Settings</comment>
+                <field id="constrain_only" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Constrain Only</label>
+                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
+                    <comment>Guarantee, that image picture will not be bigger, than it was. It is false by default.</comment>
+                </field>
+                <field id="keep_aspect_ratio" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Keep Aspect Ratio</label>
+                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
+                    <comment>Guarantee, that image picture width/height will not be distorted. It is true by default.</comment>
+                </field>
+                <field id="keep_transparency" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Keep Transparency</label>
+                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
+                    <comment>Guarantee, that image will not lose transparency if any. It is true by default.</comment>
+                </field>
+                <field id="keep_frame" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Keep Frame</label>
+                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
+                    <comment>Guarantee, that image will have dimensions, set in $width/$height. Not applicable, if keepAspectRatio(false).</comment>
+                </field>
+                <field id="background_color" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Background Color</label>
+                    <comment>Default white</comment>
+                </field>
+            </group>
+            <group id="save" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
+                <label>Image Saved Settings</label>
+                <comment>Default Save Settings</comment>
+                <field id="identifier" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Identifier</label>
+                </field>
+                <field id="basename" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Basename</label>
+                </field>
+                <field id="width" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Width</label>
+                </field>
+                <field id="height" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Height</label>
+                </field>
+                <field id="compression" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
+                    <label>Compression</label>
+                </field>
+            </group>
+        </section>
+    </system>
+</config>
diff --git a/etc/config.xml b/etc/config.xml
new file mode 100644
index 0000000..2946657
--- /dev/null
+++ b/etc/config.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
+    <default>
+        <categorywidget>
+            <resize>
+                <constrain_only>0</constrain_only>
+                <keep_aspect_ratio>1</keep_aspect_ratio>
+                <keep_transparency>1</keep_transparency>
+                <keep_frame>1</keep_frame>
+                <background_color>#ffffff</background_color>
+            </resize>
+            <save>
+                <identifier>cw</identifier>
+                <basename></basename>
+                <width>1920</width>
+                <height>1080</height>
+                <compression>60</compression>
+            </save>
+        </categorywidget>
+    </default>
+</config>
-- 
GitLab