Allow passing arbitrary properties to the Replicate events

Created on 14 August 2019, over 5 years ago
Updated 11 January 2024, over 1 year ago

Problem/Motivation

A typical workflow for manual Replication through the user interface follows the pattern:

  1. Open the 'Replicate' form
  2. Enter some overrides that should apply to the replicated entity.
  3. Submit the confirm form.

Currently, modules supplying overrides for #2 have to implement a form alter hook and a submit hook to apply the overrides to the replicated entity. This implementation could become more OO and testable if the overrides could be applied through the Replicate events as arbitrary properties, similar to the current implementation in Entity Clone:

  /**
   * Constructs an EntityCloneEvent object.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The original entity that was cloned.
   * @param \Drupal\Core\Entity\EntityInterface $cloned_entity
   *   The clone of the original entity.
   * @param array $properties
   *   The entity's properties.
   */
  public function __construct(EntityInterface $entity, EntityInterface $cloned_entity, array $properties = []) {
    $this->entity = $entity;
    $this->clonedEntity = $cloned_entity;
    $this->properties = $properties;
  }

See \Drupal\entity_clone\Event\EntityCloneEvent

Proposed resolution

Allow passing arbitrary properties to the Replicate events

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

To be determined.

Data model changes

To be determined.

πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands idebr

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024