Problem/Motivation
When I try to import content using the default_content module, the display id is not set.
From the json file exported using default_content:
"leggodt_view_field": [
{
"target_id": "services",
"display_id": "block_1",
"arguments": "",
"lang": "en"
}
After importing, the database looks like this:

Proposed resolution
Ensure that the display_id and arguments are properly imported.
The database should look like this after import:

| Comment | File | Size | Author |
|---|---|---|---|
| #2 | viewfields_do_not-2890761-2.patch | 1.25 KB | john cook |
| desired db.png | 14.02 KB | john cook | |
| database.png | 13.9 KB | john cook |
Comments
Comment #2
john cook commentedAfter looking into this problem, it turns out that the default normalizer for reference field (which viewfield entries are one of) only use the target_id value from the imported data.
I've created a new normalizer for viewfield entries to fill in the missing data.
This should also fix any service based importing of viewfields.
Comment #3
socialnicheguru commentedOn Drupal 8.4.2 I think the hal module is a dependency now
Error here:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The [error]
service "viewfield.entity_reference_item" has a dependency on a non-existent service
"hal.link_manager". in
drupal-8.4.0/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:58
Comment #4
maxilein commentedComment #5
jerdavisHAL is not required for the export of normal entity reference fields. I'd like to understand why we can't affect this without enabling HAL? If we have to enable HAL, I'd almost prefer that this be moved into a sub module so it was optional to enable it. I'd like to have further discussion here prior to merging this.
Comment #6
maxilein commentedI think I had this error simply after upgrading or enabling of the module ... I never imported anything.
Enabling HAL made the error go away.
Comment #7
jerdavisYou wouldn't get this error with Viewfield unless you applied the patch on this issue which requires HAL. My point was that HAL isn't required to be enabled for Entity Reference fields, so I'd hoped we could provide an alternative solution for this issue that didn't require HAL to be enabled. Baring that, I'd ask that this patch be split and added to a sub-module for API integration for Viewfield so it's not required on all sites. A site that isn't using API access or default content with Viewfield shouldn't require this code or the HAL module being enabled.
Comment #9
jerdavisReworked to follow Entity Reference Revision's methodology and include a ViewfieldServiceProvider class that will conditionally provide a service definition based on the enabled state of the HAL module.