Two years ago, I developed under Magento 1.9 a module aiming at adding a new product custom option input type using this tutorial :
http://magento.ikantam.com/qa/custom-input-types-custom-options
I would like now to do the same under Magento 2.1, but as I am just starting developing under Magento 2, I did not manage...
I saw the method to add a product type was to write a product_types.xml file declaring the new type. Is it possible to do the same way, i.e. creating a product_option_types.xml or something like?
Could you please help me on this custom option input type xml declaration?
Thanks for your help,
EDIT :
I started the module using other module examples :
Mine/Custoptiontype/etc/module.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mine_Custoptiontype" setup_version="2.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>
Mine/Custoptiontype/etc/product_types.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd">
<option name="xfile" label="X File" renderer="Mine\Custoptiontype\Block\Adminhtml\Product\Edit\Tab\Options\Type\Xfile">
<inputType name="xfile" label="X File" />
</option>
</config>
Mine\Custoptiontype\Block\Adminhtml\Product\Edit\Tab\Options\Type\Xfile.php
<?php
namespace Mine\Custoptiontype\Block\Adminhtml\Product\Edit\Tab\Options\Type;
class Xfile extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\AbstractType
{
/**
* @var string
*/
protected $_template = 'catalog/product/edit/options/type/xfile.phtml';
}
I then installed the module. My new option type is present in the backend under product, but when I select it, the file.phtml is not displayed...