Hook page.create:before, how to edit user input?

You could also overwrite the create() method of the parent page in a custom page model.


class ParentPage extends Page
{
    /**
     * Creates and stores a new page
     *
     * @param array $props
     * @return Page
     */
    public static function create(array $props): Page
    {
        $props['slug'] = 'mynewslug';
        
        return parent::create($props);
    }
}

11 Likes