0
<field name="agent" sortOrder="170" >
    <argument name="data" xsi:type="array">
        <item name="options" xsi:type="object"></item>
        <item name="config" xsi:type="array">
        <item name="label" xsi:type="string" translate="true">Module</item>
        <item name="visible" xsi:type="boolean">true</item>
        <item name="dataType" xsi:type="string">number</item>
        <item name="formElement" xsi:type="string">select</item>
        <item name="source" xsi:type="string">Test</item>
        <item name="dataScope" xsi:type="string">Module</item>
    </item>
</argument>
</field>
1

Check Cms module example. Your options tag object is empty. Add class following way:


<item name="options" xsi:type="object">Magento\Cms\Model\Page\Source\PageLayout</item>

And check here how create class as an example. Add your option class inside toOptionArray method. Ex:


/**
 * Get options
 *
 * @return array
 */
public function toOptionArray()
{
    if ($this->options !== null) {
        return $this->options;
    }

    $configOptions = $this->pageLayoutBuilder->getPageLayoutsConfig()->getOptions();
    $options = [];
    foreach ($configOptions as $key => $value) {
        $options[] = [
            'label' => $value,
            'value' => $key,
        ];
    }
    $this->options = $options;

    return $this->options;
}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.