Jump to content

Real cases when you use $page->meta


Zeka
 Share

Recommended Posts

My module TrelloWire module uses $page->meta as an easy, site-independent way to associate module data with a page. The module creates Trello cards for new pages, and can update them through Trello's API whenever the page is changed. To do this, the module needs to store the ID of the card associated with that page somewhere. Using $page->meta was the easiest option, much simpler than creating a custom database table or programmatically creating a field when the module is installed. The caveat is that the value can't be updated or deleted through the user interface. However, that could be achieved through hooks.

You can see how I store and use the page meta data in TrelloWire::createCardForPage and TrelloWire::buildCardData ?

  • Like 7
Link to comment
Share on other sites

RockMatrix --> thats a modules similar to RepeaterMatrix. When a matrix item is created, a meta entry stores the reference to the page, where the matrix item lives on. That's similar to the TrelloWire example ? 

RockMeta --> that are fields for the PW backend that do not store their value in their own DB table but in page meta-data. This is great, because I can add Inputfields to existing Inputfields to make them more flexible without having to create many fields in the system.

pzXUBfm.png

  • Like 7
Link to comment
Share on other sites

5 hours ago, bernhard said:

RockMatrix --> thats a modules similar to RepeaterMatrix. When a matrix item is created, a meta entry stores the reference to the page, where the matrix item lives on. That's similar to the TrelloWire example ? 

RockMeta --> that are fields for the PW backend that do not store their value in their own DB table but in page meta-data. This is great, because I can add Inputfields to existing Inputfields to make them more flexible without having to create many fields in the system.

@bernhard, are those two publicly available? Could not find them nowhere)

Link to comment
Share on other sites

@MoritzLost, @markus_blue_tomato Thanks, will look through your examples.

18 hours ago, bernhard said:

RockMeta --> that are fields for the PW backend that do not store their value in their own DB table but in page meta-data. This is great, because I can add Inputfields to existing Inputfields to make them more flexible without having to create many fields in the system.

@bernhard I have a request from a client to provide a batch of fields that in most cases will act as controls of hooks that should or should not be run on page save, but this fields should also save the state, so there should be some storage and I was thinking that using page meta is the good route for such task. (Though now we have Combo field that also perfectly fit).  I'm also as @Ivan Gretsky interesting to see your implementation, of course, if it is possible. 

Thanks, guys. Best community. 

Link to comment
Share on other sites

11 hours ago, Ivan Gretsky said:

@bernhard, are those two publicly available? Could not find them nowhere)

Nope. Both are quite experimental at the moment. Not in the sense that things don't work, but experimental so that things might change, there are no proper docs etc...

  • Like 2
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...