4
  • I wish to create a form in admin.
  • The purpose of the form is not CRUD.
  • Using blocks for creating forms is marked as deprecated in favor of ui_component forms
  • Is it possible to use a ui component form without a data source?
  • Hello @vitoriodachef, did you find any solution? – vedu May 25 '18 at 5:17
  • @vedu Please check my answer – vitoriodachef May 25 '18 at 9:17
6

From my digging it turns out the data provider is required.

I just implemented a dummy data provider.

class Form extends \Magento\Ui\DataProvider\AbstractDataProvider
{
    /**
     * Get data
     *
     * @return array
     */
    public function getData()
    {
        return [];
    }

    public function addFilter(\Magento\Framework\Api\Filter $filter)
    {
        return;
    }
}

I had to override both methods that work with $collection member to avoid errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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