app/models/concerns/base_page.rb
# Returns a collection of media items that represent the basic images on the page. Override this
# method in your host app if your pages often contain images stored under other attribute names.
Returns a collection of media items that represent the basic images on the page. Override this
method in your host app if your pages often contain images stored under other attribute names.
Returns a collection of media items that represent the basic images on the page . Override this method in your host app if your pages often contain images stored under other attribute names .
def typical_media_items
    media_item_ids = []
    media_item_ids.push(featured_image_id) if featured_image_id.present?
    blocks.each do |b|
      media_item_ids.push(b.media_item_id) if b.try(:media_item_id).present?
      media_item_ids.concat(b.media_item_ids) if b.try(:media_item_ids).present?
    end
    if media_item_ids.present?
      MediaItem.where(id: media_item_ids.uniq)
    else
      MediaItem.none
    end
  end
def typical_media_items media_item_ids = [ ] media_item_ids . push ( featured_image_id ) if featured_image_id . present? blocks . each do | b | media_item_ids . push ( b . media_item_id ) if b . try ( :media_item_id ) . present? media_item_ids . concat ( b . media_item_ids ) if b . try ( :media_item_ids ) . present? end if media_item_ids . present? MediaItem . where ( id : media_item_ids . uniq ) else MediaItem . none end end
Returns a collection of media items that represent the basic images on the page.
Returns a collection of media items that represent the basic images on the page .