Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295434

Add a public API for aliasing resource type names

$
0
0

Problem/Motivation

JSON:API has \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent to allow fields to be aliased, fields to be disabled and resource types to be disabled. Those were the three first public PHP APIs for the jsonapi module.

A logical next one would be to allow resource types to be aliased.

Related: @bojanz in #3032787-21: [META] Start creating the public PHP API of the JSON:API module.

Proposed resolution

  1. Allow entity types to declare a JSON:API resource type name using a jsonapi_resource_type_name entity type annotation key.
  2. Add a new method to \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent.

(Option 2 is preferred by @e0ipso, @gabesullice and @Wim Leers because it solved more problems: it allows any module to override it. So: more power, more consistency, smaller API surface.)

Remaining tasks

User interface changes

None.

API changes

A new method on \Drupal\jsonapi\ResourceType\ResourceTypeBuildEvent.

Data model changes

None.

Release notes snippet

TBD


Viewing all articles
Browse latest Browse all 295434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>