medienbaecker / kirby-modules

Plugin for modular Kirby websites
MIT License
73 stars 7 forks source link

Skipping delete confirmation dialog on Kirby 3.7 #34

Closed nilshoerrmann closed 2 months ago

nilshoerrmann commented 2 years ago

On Kirby 3.7, the parent page model needs to be adjusted to skip the subpage delete confirmation because the new dialog implementation does no longer use hasChildren to check for existing children (not sure why). Updating the children method does the trick:

    public function children()
    {
        return parent::children()->filterBy(
            'intendedTemplate',
            '!=',
            'modules'
        );
    }

I'm not sure if this will have any undesired side effects though.

nilshoerrmann commented 2 years ago

Okay, this actually makes the plugin think it needs to create the modules folder even if it's already there because $page->find('modules') won't ever return any results. So this needs a different solution.

This is the new dialog implementation in the core: https://github.com/getkirby/kirby/blob/main/config/areas/site/dialogs.php#L379

medienbaecker commented 2 years ago

I had a look at the updated core code and I'm not sure if/how we can fix this. Personally I don't mind the delete confirmation too much.

nilshoerrmann commented 2 years ago

Personally, I can live with delete confirmations as well – but my guess is that clients will be surprised when they don't actually know about their modules being subpages.

My guess is that this can only be solved nicely when the core switches to hasChildren() again (a method which is used in other places across the dialogs, so I guess this is more of an oversight).

medienbaecker commented 2 years ago

I agree. They'd probably have to switch to $page->hasChildren() || $page->hasDrafts().

medienbaecker commented 2 months ago

I'll close this for now because it's not under my control.