Hello,

When using modules such as https://www.drupal.org/project/link_class or https://www.drupal.org/project/link_attributes, the "options" field in a link field is output in the JSON API representation of an entity, but it is empty.

Is it by design or a missing implementation?

Thanks for the reply.

Comments

Grimreaper created an issue. See original summary.

e0ipso’s picture

Please provide more information about this. The more information the higher the likelihood that someone investigates this.

wim leers’s picture

Title: Output link fields option » Link fields' "options" not normalized
Category: Feature request » Bug report
Status: Active » Closed (duplicate)
Issue tags: +API-First Initiative
Related issues: +#2895532: @DataType=map cannot be normalized, affects @FieldType=link, @FieldType=map

Both those modules store link options. \Drupal\link\Plugin\Field\FieldType\LinkItem defines this options property like this:

    $properties['options'] = MapDataDefinition::create()
      ->setLabel(t('Options'));

As you can see, it uses the MapDataDefinition typed data definition. And that in turn leads to #2895532: @DataType=map cannot be normalized, affects @FieldType=link, @FieldType=map — which is actively being worked on. Once that is fixed, this should start working too.

grimreaper’s picture

Hello,

Thanks @Wim Leers for pointing the core issue, I was not aware of it.