Camaleon CMS Create Own Custom Fields (Simple Country Select)
#/themes/e_shop/views/custom_field/_country_select.html.erb | |
<div class="group-input-fields-content"> | |
<%= select_tag "#{field_name}[#{field.slug}][values][]", options_for_select(ISO3166::Country.all_names_with_codes), class: "form-control input-value #{"required" if field.options[:required].to_s.to_bool}" %> | |
</div> |
// /themes/e_shop/config/config.json | |
{ | |
... | |
... | |
"hooks": { | |
"extra_custom_fields": ["eshop_extra_custom_fields"] | |
} | |
} |
#/themes/e_shop/main_helper.rb | |
module Themes::EShop::MainHelper | |
def eshop_extra_custom_fields(args) | |
args[:fields][:my_country_select] = { | |
key: 'my_country_select', | |
label: 'Country Selector', | |
render: theme_view('custom_field/country_select.html.erb'), | |
options: { | |
required: true, | |
multiple: true, | |
} | |
} | |
end | |
end |
This comment has been minimized.
This comment has been minimized.
It is not work in https://github.com/owen2345/camaleon-cms/tree/master/spec/dummy, but work in standlone rails appliation. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Result:

