Resolve "Create Route for Delete Translation"
Adds DELETE API endpoints for removing Canvas entity translations, for both content entities (canvas_page) and config entities (content_template, page_region).
Content entity (canvas_page):
- Route:
DELETE /canvas/api/v0/content/canvas_page/{canvas_page}/translations - Language is determined by the URL prefix (Drupal language negotiation) — there is no
{language}path parameter. - Returns
204 No Contenton success. - Returns
400if the resolved translation is the default (Drupal negotiation falls back to the default when the requested language has no translation). - Access:
canvas_page.updateentity permission. - Controller:
ApiTranslationControllers::delete()
Config entities (content_template, page_region):
- Route:
DELETE /canvas/api/v0/config/{entity_type_id}/{config_entity}/translations - Deletes the language config override for the current language.
- Returns
204 No Contenton success;400if no override exists for that language. - Access:
translate configurationpermission. - Controller:
ApiTranslationControllers::deleteConfigTranslation()
Tests added to TranslationTest:
testDeleteCanvasPageTranslation()— covers204(success) and400(default or already-deleted translation) forcanvas_page.testDeleteConfigEntityTranslation()— data-provider test covering bothcontent_templateandpage_region.
Testing instructions
As this has no UI until https://git.drupalcode.org/project/canvas/-/work_items/ 3591459 calls these routes, just ensure that tests pass and cover the need logic
AI Disclosure: large portions with made with Claude code(tedbow)
Closes #3591588 (closed)
Edited by Tim Plunkett