Sha256: af37896c2abb86a791139f2709f5a2dc02f05b6c6886d8ca0288e828711ddca7

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

# rubocop:disable Style/ClassAndModuleChildren
module Maglev::GetPageSections::TransformCollectionItemConcern
  def transform_collection_item_content_setting(content, setting)
    item_id = content&.dig('value', 'id')
    return if item_id.blank?

    item = fetch_collection_items.call(
      collection_id: setting.options[:collection_id],
      id: item_id
    )

    content['value']['label'] = item.label
    content['value']['item'] = item.source
  end
end
# rubocop:enable Style/ClassAndModuleChildren

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maglevcms-1.1.7 app/services/concerns/maglev/get_page_sections/transform_collection_item_concern.rb