Jet\Form_Renderer_Field_Input_RadioButton

The Renderer selects options using so-called radio buttons. The class inherits from Form_Renderer_Field_Input.

Default view scripts

The name of the default view script is field/input/radio-button.

The value in the system configuration can be accessed as follows:

$view_script_start SysConf_Jet_Form_DefaultViews::get($field->getType(), 'input'); SysConf_Jet_Form_DefaultViews::set$field_type 'input''my-view-script');

Overview of methods

Method Meaning of
public setCurrentOption(
string $option_key,
Form_Field_Select_Option $option
) : void
The radio button field is quite specific. The field does not represent one specific radio button displayed, but based on the set options, the whole set of radio buttons is displayed, including the labels.

This means that the view script has to generate a number of input tags, but each with a different value and a different ID. To make it easier, there is this method, which is used as follows: foreach( $field->getSelectOptions() as $key => $option ):
    
$renderer->setCurrentOption$key$option );
    
?>
    <div>
        <input <?=$renderer->renderTagAttributes()?>/>
        <label for="<?= $renderer->getFieldId() ?>"><?= $option ?></label>
    </div>
    <?php 
endforeach;
public getFieldId(
) : string
See method setCurrentOption
protected generateTagAttributes_Standard(
) : void
This internal method generates the standard HTML attributes of the input tag based on the form field settings.
Previous chapter
Jet\Form_Renderer_Field_Input_MultiSelect
Next chapter
Jet\Form_Renderer_Field_Input_Textarea