Module: Maglev::GetPageSections::TransformCollectionItemConcern
- Included in:
- Maglev::GetPageSections
- Defined in:
- app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb
Overview
rubocop:disable Style/ClassAndModuleChildren
Instance Method Summary collapse
Instance Method Details
#transform_collection_item_content_setting(content, setting) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb', line 5 def transform_collection_item_content_setting(content, setting) # the content might come from the default value of the collection_item setting # rubocop:disable Style/StringHashKeys content['value'] = { 'id' => 'any' } if content&.dig('value') == 'any' # rubocop:enable Style/StringHashKeys item_id = content&.dig('value', 'id') return if item_id.blank? item = fetch_collection_items.call( collection_id: setting.[:collection_id], id: item_id ) return unless item content['value']['label'] = item.label content['value']['item'] = item.source end |