sitepress-rails/rails/app/controllers/concerns/sitepress/site_pages.rb
# Returns the current layout for the inline Sitepress renderer. This is
# exposed via some really convoluted private methods inside of the various
# versions of Rails, so I try my best to hack out the path to the layout below.
Returns the current layout for the inline Sitepress renderer. This is
exposed via some really convoluted private methods inside of the various
versions of Rails, so I try my best to hack out the path to the layout below.
Returns the current layout for the inline Sitepress renderer . This is exposed via some really convoluted private methods inside of the various versions of Rails so I try my best to hack out the path to the layout below .
def controller_layout
      private_layout_method = self.method(:_layout)
      layout =
        if Rails.version >= "6"
          private_layout_method.call lookup_context, current_resource_rails_formats
        elsif Rails.version >= "5"
          private_layout_method.call current_resource_rails_formats
        else
          private_layout_method.call
        end
      if layout.instance_of? String 
        layout
      elsif layout 
        File.basename(layout.identifier).split('.').first
      else
        nil
      end
    end
def controller_layout private_layout_method = self . method ( :_layout ) layout = if Rails . version >= "6" private_layout_method . call lookup_context , current_resource_rails_formats elsif Rails . version >= "5" private_layout_method . call current_resource_rails_formats else private_layout_method . call end if layout . instance_of? String layout elsif layout File . basename ( layout . identifier ) . split ( '.' ) . first else nil end end
Returns the current layout for the inline Sitepress renderer.
Returns the current layout for the inline Sitepress renderer .
# Rails 4 and 5 return a string from above. # Rails 3 and older return an object that gives us a file name # If none of the conditions are met, then no layout was # specified, so nil is returned.