我尝试在UI表单中添加xml类型的值,但我发现方法不成功。
例如:这是我的密码
<field name="client_id">
<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">ClientId</item>
<item name="value" xsi:type="string" translate="true">Module\Core\DataObjects</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">smartbusiness</item>
<item name="dataScope" xsi:type="string">client_id</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
<item name="min_text_length" xsi:type="number">10</item>
<item name="max_text_length" xsi:type="number">250</item>
<item name="no-whitespace" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
在我的自定义类中
<?php
namespace Module\Core\DataObjects;
use Module\Core\Model\SettingsFactory;
use Magento\Framework\App\ObjectManager;
class SettingsData
{
protected array $setting = [];
public function __construct()
{
$objectManager = ObjectManager::getInstance();
$modelFactory = $objectManager->get(SettingsFactory::class);
$collection = $modelFactory->create()->getCollection();
$collection->getSelect()->limit(1);
if ($collection->getSize()) {
$this->setting = $collection->getData()[0];
}
}
public function getData()
{
return $this->getClientId();
}
}
有什么想法吗?我也试过将class ="Name of my class"赋值,但没有成功
我尝试了上面的方法+在class属性中附加类名
1条答案
按热度按时间ygya80vv1#
步骤1:-在视图中创建用户界面表单/adminhtml/用户界面组件/sunarc演示类型表单. xml
步骤2:-在Model/UI/DataProvider.php中创建数据源文件
Click Here to check the input