medienbaecker / kirby-modules

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

Error: Call to a member function url() on null #38

Closed dustsucker closed 1 year ago

dustsucker commented 1 year ago

I tried to use the separate modules' folder approach, so I could use "global" Modules so making modules with site.yml and using them as blocks within every page I have so if I change something inside the module it applies to every page I use the module on the plugin seems perfect for that. The Problem I have is that the modules section is displayed, and I try to create a module with the normal add button so like a page select the Default Module Template I created, and it gives me the Error Message: Error: Call to a member function url() on null.

For context, the site.yml looks like this:

# site/blueprints/site.yml
title: Site

columns:
  - width: 1/2
    sections:
        pages:
          type: pages
  - width: 1/2
    sections:
        modules: true

and the Default module like this:

# site/modules/default/default.yml
title:
  en: Module-Default
  de: Module-Default
fields:
  header:
    type: layout
    pretty: true
    layouts:
      - "1/1"
      - "1/2, 1/2"
    fieldsets:
      - heading
      - text
      - list
      - image
      - gallery
      - video
      - code
      - markdown

the section modules Displays the pages I already have: image

And The error i get: image

I'm pretty sure it has something to do with a small error on my site, but I can't find it. Or is this not possible because it has to have a page as parent?

medienbaecker commented 1 year ago

I don't use modules in the site/dashboard — normally only on pages or the home page for global stuff. Nevertheless, I refactored some things related to finding the parent page of modules and published a pre-release: https://github.com/medienbaecker/kirby-modules/releases/tag/2.5.1

Could you please test this and report back if it works for you?

dustsucker commented 1 year ago

Now it works perfectly for the stuff I need it for 👍

Thank you for your work!!!