From 3e79febcd45e110a38549fe65e8a1d6108c49135 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sun, 25 Aug 2019 21:06:33 +0300 Subject: [PATCH] feat(core): add sizes for Forms #218 #186 New sizes: '1/12' => 'col-1', '2/12' => 'col-2', '3/12' => 'col-3', '4/12' => 'col-4', '5/12' => 'col-5', '6/12' => 'col-6', '7/12' => 'col-7', '8/12' => 'col-8', '9/12' => 'col-9', '10/12' => 'col-19', '12/12' => 'col-11', '12' => 'col-12' --- flextype/core/Forms.php | 17 ++++++++++++++++- site/fieldsets/about.yaml | 16 ++++++++-------- site/fieldsets/blog-post.yaml | 8 ++++---- site/fieldsets/blog.yaml | 14 +++++++------- site/fieldsets/default.yaml | 18 +++++++++--------- site/fieldsets/gallery-item.yaml | 6 +++--- site/fieldsets/gallery.yaml | 12 ++++++------ 7 files changed, 53 insertions(+), 38 deletions(-) diff --git a/flextype/core/Forms.php b/flextype/core/Forms.php index fbc5eb4f..7e4b67d8 100644 --- a/flextype/core/Forms.php +++ b/flextype/core/Forms.php @@ -27,6 +27,21 @@ class Forms */ private $flextype; + private $sizes = [ + '1/12' => 'col-1', + '2/12' => 'col-2', + '3/12' => 'col-3', + '4/12' => 'col-4', + '5/12' => 'col-5', + '6/12' => 'col-6', + '7/12' => 'col-7', + '8/12' => 'col-8', + '9/12' => 'col-9', + '10/12' => 'col-19', + '12/12' => 'col-11', + '12' => 'col-12' + ]; + /** * Constructor * @@ -78,7 +93,7 @@ class Forms $property['attributes']['class'] = Arr::keyExists($property, 'attributes.class') ? 'form-control ' . $property['attributes']['class'] : 'form-control'; // Create attribute size - $property['size'] = Arr::keyExists($property, 'size') ? $property['size'] : 'col-12'; + $property['size'] = Arr::keyExists($property, 'size') ? $this->sizes[$property['size']] : $this->sizes['12']; // Create attribute value $property['value'] = Arr::keyExists($property, 'value') ? $property['value'] : ''; diff --git a/site/fieldsets/about.yaml b/site/fieldsets/about.yaml index 465cda61..af218667 100644 --- a/site/fieldsets/about.yaml +++ b/site/fieldsets/about.yaml @@ -7,33 +7,33 @@ sections: title: title: admin_title type: text - size: col-12 + size: 12 content: title: admin_content type: html - size: col-12 + size: 12 image: title: admin_media type: media_select - size: col-3 + size: 3/12 seo: title: Seo fields: description: title: admin_description type: textarea - size: col-12 + size: 12 menu: title: Menu fields: menu_item_title: title: admin_menu_item_title type: text - size: col-4 + size: 4/12 menu_item_url: title: admin_menu_item_url type: text - size: col-4 + size: 4/12 menu_item_target: title: admin_menu_item_target type: select @@ -42,8 +42,8 @@ sections: _blank: _blank _parent: _parent _top: _top - size: col-4 + size: 4/12 menu_item_order: title: admin_menu_item_order type: text - size: col-4 + size: 4/12 diff --git a/site/fieldsets/blog-post.yaml b/site/fieldsets/blog-post.yaml index ed1578c2..bae15ebd 100644 --- a/site/fieldsets/blog-post.yaml +++ b/site/fieldsets/blog-post.yaml @@ -7,19 +7,19 @@ sections: title: title: admin_title type: text - size: col-12 + size: 12 summary: title: admin_summary type: html - size: col-12 + size: 12 content: title: admin_content type: html - size: col-12 + size: 12 seo: title: Seo fields: description: title: admin_description type: textarea - size: col-12 + size: 12 diff --git a/site/fieldsets/blog.yaml b/site/fieldsets/blog.yaml index eed26b2c..cd7a9b9a 100644 --- a/site/fieldsets/blog.yaml +++ b/site/fieldsets/blog.yaml @@ -7,29 +7,29 @@ sections: title: title: admin_title type: text - size: col-12 + size: 12 entries_limit: title: admin_entries_limit type: text - size: col-4 + size: 4/12 seo: title: Seo fields: description: title: admin_description type: textarea - size: col-12 + size: 4/12 menu: title: Menu fields: menu_item_title: title: admin_menu_item_title type: text - size: col-4 + size: 4/12 menu_item_url: title: admin_menu_item_url type: text - size: col-4 + size: 4/12 menu_item_target: title: admin_menu_item_target type: select @@ -38,8 +38,8 @@ sections: _blank: _blank _parent: _parent _top: _top - size: col-4 + size: 4/12 menu_item_order: title: admin_menu_item_order type: text - size: col-4 + size: 4/12 diff --git a/site/fieldsets/default.yaml b/site/fieldsets/default.yaml index c4d14ebe..8ae23d55 100644 --- a/site/fieldsets/default.yaml +++ b/site/fieldsets/default.yaml @@ -7,37 +7,37 @@ sections: title: title: admin_title type: text - size: col-12 + size: 12 content: title: admin_content type: html - size: col-12 + size: 12 template: title: admin_template type: template_select - size: col-4 + size: 4/12 visibility: title: admin_visibility type: visibility_select - size: col-4 + size: 4/12 seo: title: Seo fields: description: title: admin_description type: textarea - size: col-12 + size: 12 menu: title: Menu fields: menu_item_title: title: admin_menu_item_title type: text - size: col-4 + size: 4/12 menu_item_url: title: admin_menu_item_url type: text - size: col-4 + size: 4/12 menu_item_target: title: admin_menu_item_target type: select @@ -46,8 +46,8 @@ sections: _blank: _blank _parent: _parent _top: _top - size: col-4 + size: 4/12 menu_item_order: title: admin_menu_item_order type: text - size: col-4 + size: 4/12 diff --git a/site/fieldsets/gallery-item.yaml b/site/fieldsets/gallery-item.yaml index 5c509ef8..72574760 100644 --- a/site/fieldsets/gallery-item.yaml +++ b/site/fieldsets/gallery-item.yaml @@ -7,15 +7,15 @@ sections: title: title: admin_title type: text - size: col-12 + size: 12 gallery_img: title: admin_gallery_img type: media_select - size: col-4 + size: 4/12 seo: title: Seo fields: description: title: admin_description type: textarea - size: col-12 + size: 12 diff --git a/site/fieldsets/gallery.yaml b/site/fieldsets/gallery.yaml index 2cd2ebdc..c2180ace 100644 --- a/site/fieldsets/gallery.yaml +++ b/site/fieldsets/gallery.yaml @@ -7,25 +7,25 @@ sections: title: title: admin_title type: text - size: col-12 + size: 12 seo: title: Seo fields: description: title: admin_description type: textarea - size: col-12 + size: 12 menu: title: Menu fields: menu_item_title: title: admin_menu_item_title type: text - size: col-4 + size: 4/12 menu_item_url: title: admin_menu_item_url type: text - size: col-4 + size: 4/12 menu_item_target: title: admin_menu_item_target type: select @@ -34,8 +34,8 @@ sections: _blank: _blank _parent: _parent _top: _top - size: col-4 + size: 4/12 menu_item_order: title: admin_menu_item_order type: text - size: col-4 + size: 4/12