Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Revert "Add ability to extend/add new CMS sections types" (#11738)

Damian Legawiecdbe272f8b092
diff --git a/api/app/controllers/spree/api/v2/platform/cms_sections_controller.rb b/api/app/controllers/spree/api/v2/platform/cms_sections_controller.rb
index c1429f0e94..34e7c83b49 100644
--- a/api/app/controllers/spree/api/v2/platform/cms_sections_controller.rb
+++ b/api/app/controllers/spree/api/v2/platform/cms_sections_controller.rb
@@ -12,7 +12,7 @@ module Spree
def spree_permitted_attributes
stored_attributes = []
- Rails.application.config.spree.cms.sections.map(&:to_s).each do |type|
+ Spree::CmsSection::TYPES.each do |type|
type.constantize.stored_attributes.each do |_name, values|
values.each do |value|
stored_attributes << value
diff --git a/core/app/models/spree/cms_section.rb b/core/app/models/spree/cms_section.rb
index 10b7749ff6..ed359d7087 100644
--- a/core/app/models/spree/cms_section.rb
+++ b/core/app/models/spree/cms_section.rb
@@ -33,6 +33,13 @@ module Spree
LINKED_RESOURCE_TYPE = []
+ TYPES = ['Spree::Cms::Sections::HeroImage',
+ 'Spree::Cms::Sections::FeaturedArticle',
+ 'Spree::Cms::Sections::ProductCarousel',
+ 'Spree::Cms::Sections::ImageGallery',
+ 'Spree::Cms::Sections::SideBySideImages',
+ 'Spree::Cms::Sections::RichTextContent']
+
def boundaries
['Container', 'Screen']
end
diff --git a/core/lib/spree/core/engine.rb b/core/lib/spree/core/engine.rb
index def2c1fec5..0666338b3a 100644
--- a/core/lib/spree/core/engine.rb
+++ b/core/lib/spree/core/engine.rb
@@ -11,11 +11,9 @@ module Spree
:adjusters,
:stock_splitters,
:promotions,
- :cms,
:line_item_comparison_hooks)
SpreeCalculators = Struct.new(:shipping_methods, :tax_rates, :promotion_actions_create_adjustments, :promotion_actions_create_item_adjustments)
PromoEnvironment = Struct.new(:rules, :actions)
- CmsEnvironment = Struct.new(:sections)
isolate_namespace Spree
engine_name 'spree'
@@ -124,16 +122,6 @@ module Spree
Promotion::Actions::CreateLineItems,
Promotion::Actions::FreeShipping
]
-
- Rails.application.config.spree.cms = CmsEnvironment.new
- Rails.application.config.spree.cms.sections = [
- Spree::Cms::Sections::HeroImage,
- Spree::Cms::Sections::FeaturedArticle,
- Spree::Cms::Sections::ProductCarousel,
- Spree::Cms::Sections::ImageGallery,
- Spree::Cms::Sections::SideBySideImages,
- Spree::Cms::Sections::RichTextContent
- ]
end
initializer 'spree.promo.register.promotions.actions' do |app|