I am developing a custom module in Magento 2.0.9 and writing the system.xml file to allow users to make some settings from backend.
Now I need to show a Radio button in custom module backend settings section. This is what I wrote in system.xml
<field id="box_small_left_h_alignment" translate="label" type="radio" sortOrder="31" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Horizontal Alignment</label>
<source_model>SG\Slider\Model\Backend\Options\HorizontalAlignment</source_model>
</field>
And this is the source model:
<?php
namespace SG\Slider\Model\Backend\Options;
class HorizontalAlignment implements \Magento\Framework\Option\ArrayInterface {
public function toOptionArray()
{
return [['value' => 'left', 'label' => __('Left')], ['value' => 'right', 'label' => __('Right')],];
}
}
Doing in this way no error are thrown in the backend but my radio field has no options. What am I missing?
return [['value' => 'left', 'label' => __('Left')], ['value' => 'right', 'label' => __('Right')],];