0

I am trying to learn how to create plugins using craft and am having a small problem.

On the templates/settings.html page I have the following code:

{% import "_includes/forms" as forms %}

{{ forms.lightswitchField({
    label: "Lightswitch Label"|t,
    instructions: "Lightswith Instructions"|t,
    name: 'lightSwitchName',
    on: settings.lightSwitchName,
}) }}



{{ forms.radioGroup({
    label: "Radio Group Label"|t,
    instructions: "Radio Group Instructions"|t,
    name: 'radioGroupName',
    options:{ "option_1" : "option_1", "option_2" : "option_2"},
    value: settings.radioGroupName
}) }}

What is interesting is that on the settings page for this plugin (in the admin control panel) the label and instructions only show up for lightswitch field and not for the radio group. Here is a screen shot:

screenshot

Am I doing something wrong? Is there a way to display a title and instructions for a radiogroup? If so, can someone please tell me how?

Thanks,

Moshe

1 Answer 1

2

You should be using forms.radioGroupField instead of forms.radioGroup, just like you're using forms.lightswitchField.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.