- Issue created by @byronveale
- 🇺🇦Ukraine ruslan piskarov Kyiv, Ukraine
Hey @byronveale.
I think you can use hook_form_alter() in your custom module.
Example:/** * Implements hook_form_alter(). */ function replicate_actions_form_alter(&$form, FormStateInterface $form_state, $form_id): void { if (strpos($form_id, '_replicate_form')) { /** @var \Drupal\replicate_actions\Form\ReplicateFormAlter $replicate_form_alter */ $replicate_form_alter = \Drupal::service('replicate_actions.replicate_form_alter'); $replicate_form_alter->alterForm($form, $form_state); } }
Or implement your own EventSubscriber:
class ReplicateChangeAutor implements ReplicateSetEntityEdit
.However, if you can create a patch, I will add this functionality to the module. I think it is a great idea.
- Merge request !123544472: added class to set author value, added service. → (Merged) created by byronveale
- 🇺🇸United States byronveale
Thanks @ruslan, I created a merge request here.
I also added a patch to this comment.
Any questions, do let me know…
- 🇺🇦Ukraine ruslan piskarov Kyiv, Ukraine
@byronveale, brilliant. I am going to review tomorrow. Thank you.
- 🇮🇳India vinodhini.e chennai
Hi, Steps to Reproduce the Issue and Verify the Fix
Tested on Drupal 11.2.3.
Installed and enabled Replicate and Replicate Actions modules.
Created two users:
User A → can create content
User B → can replicate contentLogged in as User A and created a Page (/node/add/page).
Logged in as User B, went to the Page created by User A, clicked Replicate, and saved the replicated page.Before applying the patch: The replicated page author was User A (original author).
Applied MR !12, cleared cache with drush cr, and repeated the same steps.
After applying the patch: The replicated page author is now User B (replicating user).
Its working fine. Thanks.
- 🇺🇸United States byronveale
Updated merge request based on code review (thanks @bkosborne), attaching updated patch too.
- 🇺🇦Ukraine ruslan piskarov Kyiv, Ukraine
Thank you @byronveale, @bkosborne and @vinodhini.e.
Merget to master. Now that this issue is closed, please review the contribution record.
As a contributor, attribute any organization helped you, or if you volunteered your own time.
Maintainers, please credit people who helped resolve this issue.