Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: EVENT_AFTER_DELETE on 'Delete entry for this site' #12354

Closed
Romanavr opened this issue Nov 21, 2022 · 5 comments
Closed

[4.x]: EVENT_AFTER_DELETE on 'Delete entry for this site' #12354

Romanavr opened this issue Nov 21, 2022 · 5 comments
Assignees

Comments

@Romanavr
Copy link

Romanavr commented Nov 21, 2022

What happened?

Description

Follow events Entry::EVENT_BEFORE_DELETE & Entry::EVENT_AFTER_DELETE are not fired when an entry is deleted by the 'Delete entry for this site' action
https://i.imgur.com/epteQ7a.png

Steps to reproduce

Attach any code to these events and delete the entry only on a specific site

        Event::on(
            Entry::class,
            Entry::EVENT_AFTER_DELETE,
            static function (Event $e) {
                var_dump('Trigger me');
            }
        );

Expected behavior

The code in the events should fire

Actual behavior

Code inside following events not fired

Craft CMS version

Craft Pro 4.2.8

PHP version

8.1.10

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@brianjhanson
Copy link
Contributor

Thanks for reporting! Deleting an element from a site isn't really a delete operation since the element still appears on other sites. I've opened a PR to add new events for this specific use case which is currently targeting a 4.4 release.

In the mean time, you might be able to solve your use case with the events called when saving elements, but that will depend a bit on your exact use case.

@Romanavr
Copy link
Author

Thanks for the answer & comment.

@brandonkelly
Copy link
Member

PR #12363 has been merged for Craft 4.4 🎉

@brandonkelly
Copy link
Member

Craft 4.4 is out now!

@Romanavr
Copy link
Author

Romanavr commented Mar 9, 2023

Sounds great, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants