Is the kirby patterns plugin still a thing in Kirby 3?

Hi everyone, I’ve been a big user of the patterns plugin for one of my previous kirby2 sites and I just realized I might be in trouble for migrating to kirby3 without it.

Even if the list of components via the /patterns url was fun and useful I can go without it to be honest. What I need to most is the pattern() function, as I was using a controller to fetch data and transfer it to my components.

I was wondering if a similar feature exists in Kirby 3 or if it’s possible to reproduce it in someway?

Thanks!

1 Like

I heard it is as simple as renaming patterns.php to index.php. But I didn’t test it myself.

I just tried renaming it but it doesn’t seem to work. When I don’t have the plugin I have the classic debugger saying to me that pattern() does not work. When I add the plugin and rename the patterns.php to index.php, my home shows me a blank page with a simple “Error” message in a h1, the rest of the dom is empty. Having the plugin activated also breaks language detection and all other pages.

Hi, have you had any luck getting it to work? I think I’m having the same issues as you, any pointers welcome!

Apologies, I got my wires crossed. Renaming patterns.php to index.php has got the patterns() function working for me, but not the styleguide interface. I’m not sure if its affected the language detection for me, but I can view other pages.
I’m getting the blank page with the h1, but I’m assuming that’s because I’m using the PlainKit? (thats the default template format).

I don’t see how just renaming the main plugin file can possibly work, considering that the plugin uses for example, toolkit classes that no longer exists as well as some other stuff.

As I said, I didn’t test it myself, it was mentioned on Slack. Sorry for the confusion.

I don’t see how just renaming the main plugin file can possibly work, considering that the plugin uses for example, toolkit classes that no longer exists as well as some other stuff.

Oh, ok. The patterns I’ve been testing it with are pretty basic (at the ‘atom’ level, outputting links / svg icons etc), but they are rendering. From what you’re saying, I’m guessing if I kept using it for more complicated components I’m going to run into problems. Thanks for the response.

On my side I just moved the patterns folder inside the snippet folder, converted the pattern() to snipper() and adjusted urls. It didn’t took a lot of time.

That’s what I did as well with the project I’m currently porting. Advantage of the snippets: easier to debug than patterns, anyway.

1 Like

Hi there, I started to make the patterns plugin compatible with Kirby 3. It’s already working, but maybe I missed some details, haven’t tested all functionality yet. Have fun :wink:

1 Like

Thanks!
I already went to the snippet() road as I said, but I’m marking your answer as a solution!

Thank you!

Cheers

Steffen

Hi! I’m currently porting a kirby 2 project and was hoping this updated plugin could come in use –

It seems as though $site , $pages, $page are not available in the plugin?

They return null.