Sha256: 383ccc1a4c8763a76630f10ccbc9e66d11b8a6ca7bb03d46d2d4f29e01099177

Contents?: true

Size: 770 Bytes

Versions: 22

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

module Hyrax
  ##
  # A factory class for Hyrax forms.
  #
  # @note We use a factory class (rather than a factory method like `.for`) to
  #   provide compatibility with the legacy `Hyrax::WorkFormService`.
  #
  # @example
  #   factory = Hyrax::FormFactory.new
  #
  #   form_change_set = factory.build(work)
  #
  # @since 3.0.0
  class FormFactory
    ##
    # Builds and prepopulates a form for the given model.
    #
    # @param model      [Object]
    # @param ability    [Hyrax::Ability]
    # @param controller [ApplicationController]
    #
    # @see https://trailblazer.to/2.0/gems/reform/prepopulator.html
    def build(model, _ability, _controller)
      Hyrax::Forms::ResourceForm.for(model).prepopulate!
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hyrax-5.0.0.rc2 app/services/hyrax/form_factory.rb
hyrax-5.0.0.rc1 app/services/hyrax/form_factory.rb
hyrax-3.6.0 app/services/hyrax/form_factory.rb
hyrax-4.0.0 app/services/hyrax/form_factory.rb
hyrax-4.0.0.rc3 app/services/hyrax/form_factory.rb
hyrax-4.0.0.rc2 app/services/hyrax/form_factory.rb
hyrax-4.0.0.rc1 app/services/hyrax/form_factory.rb
hyrax-3.5.0 app/services/hyrax/form_factory.rb
hyrax-4.0.0.beta2 app/services/hyrax/form_factory.rb
hyrax-3.4.2 app/services/hyrax/form_factory.rb
hyrax-4.0.0.beta1 app/services/hyrax/form_factory.rb
hyrax-3.4.1 app/services/hyrax/form_factory.rb
hyrax-3.4.0 app/services/hyrax/form_factory.rb
hyrax-3.3.0 app/services/hyrax/form_factory.rb
hyrax-3.2.0 app/services/hyrax/form_factory.rb
hyrax-3.1.0 app/services/hyrax/form_factory.rb
hyrax-3.0.2 app/services/hyrax/form_factory.rb
hyrax-3.0.1 app/services/hyrax/form_factory.rb
hyrax-3.0.0 app/services/hyrax/form_factory.rb
hyrax-3.0.0.pre.rc4 app/services/hyrax/form_factory.rb