Hi,
i’d like to use this for overwriting the url with a random string for newly added content.
So i added this code to site/model/event.php and changed the class name to EventPage. I also added a page blueprint (event.yml) with custom fields to site/blueprints/pages. After clicking “Create draft” in the panel the new create function is not getting called and so the new content has still the same default url. Do you have any further information what i’m doing wrong?
If your parent is the page with the events.yml blueprint like in the example, your model has to match that page, e.g. you would have to create an events.php model with the method above.
Nope, that code should still work. It has nothing to do with the hooks. Do you get an error or just not the desired result? Are you using this in conjunction with a plugin?
This doesn’t print any error. Only the command is not executed. When I go back to version 3.3.6, then the code works again. The file is only in the site/models folder. S plugins it isn’t connect.
Just had a look at this. It is related to this commit. So instead of overwriting the create method on the parent model you now have to do this on the actual page model that is going to be created.
@texnixe could you please add a info to my post above like:
Since Kirby 3.4 you need to overwrite the create method on the actual page model that is going to be created. Not the parent model!