add processor for redirect entities

Created on 19 May 2025, 4 days ago

Problem/Motivation

This should check for redirect entities which redirect to the current pulled entity's system path or path alias.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

3.0

Component

Entity Share Client

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joachim
  • 🇬🇧United Kingdom joachim

    I've hit a bit of a problem with this, as a redirect processor needs the remote entity ID in order to assemble a canonical URI for the entity on the server, which it can then use to query for the relevant redirect entities.

    However, by the time we get to processEntity() in the processor, DefaultDataProcessor::prepareImportableEntityData() has already removed the "drupal_internal__id" key from the attributes array, so we've lost the remote entity ID!

    Could a copy of the original incoming JSON data be set in the JSON array, say at '_attributes_original'?

  • 🇫🇷France Grimreaper France 🇫🇷

    Hi,

    Can a redirect processor implements prepareImportableEntityData method and execute it before DefaultDataProcessor so it can store needed data for a later stage execution?

  • 🇬🇧United Kingdom joachim

    Oh yeah, good point!

    I did that with the PathAliasProcessor too.

    But TBH it's pretty messy -- plugins shouldn't be storing state data like this.

    Also, the 'prepare_importable_entity_data' stage is the same one in which DefaultDataProcessor removes the remote IDs, so it means that the RedirectProcessor **must** run before it -- that's pretty brittle.

  • 🇬🇧United Kingdom joachim

    Got this working, will push a MR tomorrow.

    • joachim committed 005822af on 8.x-3.x
      Issue #3525229 by joachim: Added processor for redirect entities.
    • joachim committed 10c68409 on 4.0.x
      Issue #3525229 by joachim: Added processor for redirect entities.
      
  • 🇬🇧United Kingdom joachim

    Committed to the 4 and 3 branches.

Production build 0.71.5 2024