Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Call dump() inside onFlexObjectAfterSave

Solved by Karmalakas View solution

Started by Daniel 5 years ago · 2 replies · 718 views
5 years ago

How can I call the dump () function inside the onFlexObjectAfterSave () function?

PHP
    public static function getSubscribedEvents() {
        return [
            'onFlexObjectAfterSave' => ['onFlexObjectAfterSave', 0],
        ];
    }

    public function onFlexObjectAfterSave($event)
    {
        $path= $this->grav['uri']->paths(1);

        if($path == "data-table"){
            $object = $event['object'];
            dump($object);
            $this->grav['debugger']->addMessage('-----------------------------------------');
            $this->grav['debugger']->addMessage($object);
            $this->grav['debugger']->addMessage('-----------------------------------------');
        }
    }

Is there a way to pause the grav before redirecting after saving? To display the result of the dump function?

5 years ago

@danielkoptak,

Is there a way to pause the grav before redirecting after saving? To display the result of the dump function?

Isn't that exactly what XDebug is created for: Pause on breakpoints and examining variables?

die() is a bit coarse don't you think?

Suggested topics

Topic Participants Replies Views Activity
Plugins · by complanar, 6 days ago
6 263 2 days ago
Plugins · by BenLaKnet, 3 days ago
1 95 3 days ago
Plugins · by complanar, 4 weeks ago
2 415 3 weeks ago
Plugins · by Vladimir Novak, 2 months ago
3 706 2 months ago
Plugins · by Mathieu Lecouturier, 2 months ago
3 545 2 months ago