Jump to content

$wire->addHookClass()?


theoretic
 Share

Recommended Posts

Hi everybody! And thanks for Processwire!

I like PW hooks and use them in almost all of my projects. But it appears i'm missing some functionality. Some pseudocode to explain my wishlist:

//somewhere in site/ready.php

addHookClass('Page(template=my_template)::my_data', function($event) {
...
}

//somewhere in site/templates/my_template.php

var_dump($page->my_data); //should output a multilevel array or nested objects

$page->my_data->set('some_var',$some_value); //doesn't write to database

$page->my_data->save(); //$page->save('my_data') is not applicable here because my_data is not a regular PW data field

In fact i'm trying to create a solution for manipulating per-user settings (how to display some data on some pages etc.) but this approach may appear to be useful in different cases.
Any suggestions are welcome!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...