steirico / kirby-plugin-custom-add-fields

Custom fields for Kirby's add dialog.
MIT License
36 stars 4 forks source link

Not working anymore in Kirby 8 #64

Closed squareclouds closed 2 years ago

squareclouds commented 2 years ago

after updating to kirby 8 everything stoped working somehow. i will try to test later with the starterkit, since i have lots of hooks besides the one from the plugin, but i am sure it has to do with the kirby version. the page gets created and renamed, but the error message shows up.

grafik

sadly, i also had a logic that sets a suffix in case pages with the same slug already exist. so i look for the same name of siblings, if it exists i append a "-xx" to the name. this was working before kirby 8 but now it does not work anymore :/ tempslug is the name of my field in the add modal

public static function hookPageCreate($page)
  {
    $tempslug = $page->tempslug();
    $duplicates = $page->parent()->childrenAndDrafts()->filterBy('slug', '==', $tempslug);

    if ($duplicates->count() > 0)
      $tempslug .= "-" . $duplicates->count();

    $page->changeSlug($tempslug);
  }

Bildschirmfoto 2022-10-17 um 09 31 24

steirico commented 2 years ago

Hi, I will have to investigate this issue.

I assume the problem is hardly related to Kirby's new Unique IDs & Permalinks features.

squareclouds commented 2 years ago

excellent, thank you for the quick response :) my project is kind of dependant of your plugin now, but i also would like to use the unique ID feature of kirby 8 since i have lots of relations between pages, it would be great if both were compatible

squareclouds commented 2 years ago

I have some new info. i think the plugin is not getting started at all. the modals are not being called.

in my case i have 2 fields

and in kirby8 the regular modal is getting loaded, where the field's name is still slug and not my tempslug

kirby 8 grafik

kirby 7 grafik

so nothing is getting called, not even the time() as default slug etc.

squareclouds commented 2 years ago

new update! it was my mistake, sorry. without really checking in detail i downloaded the latest version, which was 1.5.1 on the list, but is actually not the latest (2.0.0). i downloaded version 2.0.0 and now everything works again in kirby8 and php 8.1, only thing still bothering is that when i have duplicate slugs the error keeps showing up, but my re-slug indexing still works anyway (for instance testpage, testpage-1, testpage-2, etc). so the pages are created are renamed correctly, but the error pops up... this was not the case in kirby7

squareclouds commented 2 years ago

another update. everything is working now :) i was double changeSlug-ing. everything is well now! sorry for not having been careful and rechecking before posting!

steirico commented 2 years ago

Good to hear! So you can confirm that the plugin works with Kirby 8?

squareclouds commented 2 years ago

yes, everything is working now with kirby 8 and php 8.1 (didnt test php 8.0, but i guess it works as well)