I have added input box in admin's system.xml along with other fields as below:
<field id="mapping" translate="label comment tooltip" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Exclude Days</label>
<frontend_model>VENDOR\DeliveryCountdown\Block\Adminhtml\System\Config\Form\Field\excludeDays</frontend_model>
<backend_model>Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</backend_model>
<comment>
<![CDATA[Add bank holidays that are not included in delivery / cut off times.]]>
</comment>
<tooltip>Delivery and cuttoff not include these days.</tooltip>
</field>
This display in admin as:
I can add many input boxes by clicking ADD button. Below is code to receive input dates of above form:
$offDays = $this->scopeConfig->getValue('deliverycountdown/general/mapping', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
But output is as below:
a:3:{s:17:"_1509434435073_73";
a:2:{s:6:"field1";s:4:"AAAA";s:6:"field2";s:10:"2017-11-01";}s:18:"_1509434856288_288";
a:2:{s:6:"field1";s:4:"BBBB";s:6:"field2";s:10:"2017-11-03";}s:18:"_1509434861359_359"; a:2:{s:6:"field1";s:4:"CCCC";s:6:"field2";s:10:"2017-11-06";} }
It would great help to get dates from this file (i think JSON).
Or guide me another way if thats possible to add fields in admin and get at front-end block file.