Jump to content
Sign in to follow this  

Using hook to change page->field in front-end edit

Recommended Posts

Any advice on how to hook page, so its fields get populated by something else than the actual saved content?

The below works fine for frontend (it's in ready.php), but has no effect in front-end editing or backend, and that is the problem here.

$this->addHookBefore('Page::render', function($event) {
  $page = $event->object;
  $page->exampleField = '123';

The information doesn't need to be saved into PW itself. It's been fetched and then on save, delivered to another database.

Share this post

Link to post
Share on other sites
            // for editing
            $this->addHookBefore('ProcessPageEdit::execute', function($e) { /* ... */ });

            // if page template = user
            $this->addHookBefore('ProcessProfile::execute', function($e) { /* ... */ });


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...