Steps to import/export views in Drupal 9
You can always create a view manually, and change the configuration one by one manually. And, all done. But, still, there is a chance of manual error. Drupal9 allows you to import-export views.
You can follow the below steps to Import and Export views
- Go to Admin/Configuration/Development/Configuration Synchronization. You will See Synchronize title and 3 tabs: Synchronize | Import | Export
- Click on Export. You can see two items:
Full Archive | Single Item
- Click on Single Item
You will be asked for configuration type from the drop-down.
- Second drop-down: "Configuration name", will be populated with all the views.
- Select the desired view.
- As you select, the next text area: "Here is your configuration" will be populated with a yml
- You need to copy this yml
Now go to the site, where you want to import that view. Follow the steps
- Goto: /Admin/Configuration/Development/Configuration Synchronization/Import/Single item
- Configuration type as View
- Paste the yml in the textarea showing next.
- Click on Import
If you see no error, your view has been successfully imported.