मैंने UI घटकों का उपयोग करके व्यवस्थापक में एक फ़ॉर्म बनाया है, इसलिए मेरे view/adminhtml/ui_component/[module]_[entity]_form.xmlपास मेरे निम्नलिखित हैं:
<field name="configuration">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Configuration</item>
<item name="formElement" xsi:type="string">textarea</item>
<item name="source" xsi:type="string">form</item>
<item name="sortOrder" xsi:type="number">30</item>
<item name="dataScope" xsi:type="string">configuration</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
अब मैं नहीं चाहता कि यह मान हो textarea, लेकिन मैं इस मूल्य के बैकएंड में अपना खुद का HTML मैजिक बनाना चाहता हूं। यह 'HTML मैजिक' अंततः JS / KnockOut का एक बहुत होगा जो पानी के नीचे अभी भी फॉर्म पोस्ट करते समय कुछ छिपे हुए डेटा भेजता है, इसलिए इसे फॉर्म का हिस्सा होना चाहिए। मैंने जोड़कर एक रेंडर जोड़ने की कोशिश की:
<item name="renderer" xsi:type="object">Vendor\Module\Block\Adminhtml\Renderer\Configurator</item>
लेकिन यह अभी भी textarea प्रदान करता है। फिर मैंने formElementएक कस्टम क्लास के साथ ऐसा करने की कोशिश की :
<item name="formElement" xsi:type="object">Vendor\Module\Component\Form\Element\Configurator</item>
लेकिन तब मुझे त्रुटि मिलती है:
The requested component ("Vendor\Module\Component\Form\Element\Configurator") is not found. Before using, you must add the implementation.
तो यहाँ 2 प्रश्न:
- क्या यह एक कस्टम फ़ॉर्म तत्व को व्यवस्थापक फ़ॉर्म में जोड़ने का सही तरीका है? (और यदि ऐसा है तो: कैसे?)
- कुछ भी होने के बावजूद: मैं कार्यान्वयन कैसे जोड़ सकता हूं? मैं यूआई-मॉड्यूल के माध्यम से खुदाई कर रहा हूं यह देखने के लिए कि उन्होंने यह कैसे किया, लेकिन मुझे कुछ भी नहीं मिल रहा है।
\Magento\Framework\View\Element\UiComponent\Config\Provider\Component\Definition::setComponentData()एक घटना का उपयोग करके एक कस्टम घटक जोड़ने के लिए देख रहा था , लेकिन यह बहुत अधिक सुविधाजनक है! मुझे वास्तव में उन Magento के 2 उदाहरणों में और अधिक देखना चाहिए।