def scopes_picker(attribute, options = {})
      picker_options = {
        id: "#{@object_name}_#{attribute}",
        class: "picker-#{options[:multiple] ? "multiple" : "single"}",
        name: "#{@object_name}[#{attribute}]"
      }

      picker_options[:class] += " is-invalid-input" if error?(attribute)

      prompt_params = yield(nil)
      scopes = selected_scopes(attribute).map { |scope| [scope, yield(scope)] }
      template = ""
      template += label(attribute, label_for(attribute) + required_for_attribute(attribute)) unless options[:label] == false
      template += @template.render("decidim/scopes/scopes_picker_input",
                                   picker_options: picker_options,
                                   prompt_params: prompt_params,
                                   scopes: scopes,
                                   checkboxes_on_top: options[:checkboxes_on_top])
      template += error_and_help_text(attribute, options)
      template.html_safe
    end
def scopes_picker(attribute, options = {})
      picker_options = {
        id: "#{@object_name}_#{attribute}",
        class: "picker-#{options[:multiple] ? "multiple" : "single"}",
        name: "#{@object_name}[#{attribute}]"
      }

      picker_options[:class] += " is-invalid-input" if error?(attribute)

      prompt_params = yield(nil)
      scopes = selected_scopes(attribute).map { |scope| [scope, yield(scope)] }
      template = ""
      template += label(attribute, label_for(attribute) + required_for_attribute(attribute)) unless options[:label] == false
      template += @template.render("decidim/scopes/scopes_picker_input",
                                   picker_options: picker_options,
                                   prompt_params: prompt_params,
                                   scopes: scopes,
                                   checkboxes_on_top: options[:checkboxes_on_top])
      template += error_and_help_text(attribute, options)
      template.html_safe
    end
Public: Generates a picker field for scope selection.

 attribute     - The name of the field (usually scope_id)
 options       - An optional Hash with options:
 - multiple    - Multiple mode, to allow multiple scopes selection.
 - label       - Show label?
 - checkboxes_on_top - Show checked picker values on top (default) or below the picker prompt

 Also it should receive a block that returns a Hash with :url and :text for each selected scope (and for null scope for prompt)

 Returns a String.