def data_picker(attribute, options = {}, prompt_params = {})
      picker_options = {
        id: "#{@object_name}_#{attribute}",
        class: "picker-#{options[:multiple] ? "multiple" : "single"}",
        name: options[:name] || "#{@object_name}[#{attribute}]"
      }
      picker_options[:class] += " is-invalid-input" if error?(attribute)

      items = object.send(attribute).collect { |item| [item, yield(item)] }

      template = ""
      template += label(attribute, label_for(attribute) + required_for_attribute(attribute)) unless options[:label] == false
      template += @template.render("decidim/widgets/data_picker", picker_options: picker_options, prompt_params: prompt_params, items: items)
      template += error_and_help_text(attribute, options)
      template.html_safe
    end
def data_picker(attribute, options = {}, prompt_params = {})
      picker_options = {
        id: "#{@object_name}_#{attribute}",
        class: "picker-#{options[:multiple] ? "multiple" : "single"}",
        name: options[:name] || "#{@object_name}[#{attribute}]"
      }
      picker_options[:class] += " is-invalid-input" if error?(attribute)

      items = object.send(attribute).collect { |item| [item, yield(item)] }

      template = ""
      template += label(attribute, label_for(attribute) + required_for_attribute(attribute)) unless options[:label] == false
      template += @template.render("decidim/widgets/data_picker", picker_options: picker_options, prompt_params: prompt_params, items: items)
      template += error_and_help_text(attribute, options)
      template.html_safe
    end
Public: Generates a picker field for selection (either simple or multiselect).

 attribute     - The name of the object's attribute.
 options       - A Hash with options:
 - multiple: Multiple mode, to allow selection of multiple items.
 - label: Show label?
 - name: (optional) The name attribute of the input elements.
 prompt_params - Hash with options:
 - url: The url where the ajax endpoint that will fill the content of the selector popup (the prompt).
 - text: Text in the button to open the Data Picker selector.

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

 Returns an html String.