You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use yii\base\Event;
use craft\services\Elements;
use craft\events\ElementEvent;
Event::on(
Elements::class,
Elements::EVENT_AFTER_SAVE_ELEMENT,
function(ElementEvent $event) {'
$entry = $event->element;
// Done, and safe to query again!
}
);
Is it correct that I need to use Elements::EVENT_AFTER_SAVE_ELEMENT for these type of webhooks, when I want to crawl the latest data from outside (via REST / GraphQL)?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I have a question regarding the correct way of doing something like this:
Looking at https://craftcms.com/docs/4.x/extend/events.html#event-code-generator I assumed I can use the following:
But while testing it, it became clear that the entry is not fully updated yet for outside crawling via GraphlQL.
I found this post on discord:
Is it correct that I need to use
Elements::EVENT_AFTER_SAVE_ELEMENT
for these type of webhooks, when I want to crawl the latest data from outside (via REST / GraphQL)?Thanks very much in advance!
Cheers,
Matthias
Beta Was this translation helpful? Give feedback.
All reactions