def render_element(*args)
      if args.length == 4
        element, _part, options, counter = *args
        Alchemy::Deprecation.warn "passing a `part` parameter as second argument to `render_element` has been removed without replacement. " \
          "You can safely remove it."
      else
        element, options, counter = *args
      end

      options ||= {}
      counter ||= 1

      if element.nil?
        warning('Element is nil')
        render "alchemy/elements/view_not_found", {name: 'nil'}
        return
      end

      element.store_page(@page)

      render element, {
        element: element,
        counter: counter,
        options: options
      }.merge(options.delete(:locals) || {})
    rescue ActionView::MissingTemplate => e
      warning(%(
        Element view partial not found for #{element.name}.\n
        #{e}
      ))
      render "alchemy/elements/view_not_found", name: element.name
    end
def render_element(*args)
      if args.length == 4
        element, _part, options, counter = *args
        Alchemy::Deprecation.warn "passing a `part` parameter as second argument to `render_element` has been removed without replacement. " \
          "You can safely remove it."
      else
        element, options, counter = *args
      end

      options ||= {}
      counter ||= 1

      if element.nil?
        warning('Element is nil')
        render "alchemy/elements/view_not_found", {name: 'nil'}
        return
      end

      element.store_page(@page)

      render element, {
        element: element,
        counter: counter,
        options: options
      }.merge(options.delete(:locals) || {})
    rescue ActionView::MissingTemplate => e
      warning(%(
        Element view partial not found for #{element.name}.\n
        #{e}
      ))
      render "alchemy/elements/view_not_found", name: element.name
    end
This helper renders a {Alchemy::Element} view partial.

 A element view partial is the html snippet presented to the website visitor.

 The partial is located in <tt>app/views/alchemy/elements</tt>.

 == View partial naming

 The partial has to be named after the name of the element as defined in the <tt>elements.yml</tt> file and has to be suffixed with <tt>_view</tt>.

 === Example

 Given a headline element

   # elements.yml
   - name: headline
     contents:
     - name: text
       type: EssenceText

 Then your element view partial has to be named like:

   app/views/alchemy/elements/_headline_view.html.{erb|haml|slim}

 === Element partials generator

 You can use this handy generator to let Alchemy generate the partials for you:

   $ rails generate alchemy:elements --skip

 == Usage

   <%= render_element(Alchemy::Element.published.named(:headline).first) %>

 @param [Alchemy::Element] element
   The element you want to render the view for
 @param [Hash] options
   Additional options
 @param [Number] counter
   a counter

 @note If the view partial is not found
   <tt>alchemy/elements/_view_not_found.html.erb</tt> gets rendered.