Zeka Posted January 7, 2021 Share Posted January 7, 2021 Hi. Could someone provide real cases when you use $page->meta to store data? Thanks. Link to comment Share on other sites More sharing options...
MoritzLost Posted January 7, 2021 Share Posted January 7, 2021 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 ? 7 Link to comment Share on other sites More sharing options...
bernhard Posted January 7, 2021 Share Posted January 7, 2021 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. 7 Link to comment Share on other sites More sharing options...
markus_blue_tomato Posted January 7, 2021 Share Posted January 7, 2021 ElasticsearchFeeder saves the document-ID returned by ElasticSearch and the time of the last sync to the correspondending page. 2 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted January 7, 2021 Share Posted January 7, 2021 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 More sharing options...
Zeka Posted January 8, 2021 Author Share Posted January 8, 2021 @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 More sharing options...
bernhard Posted January 8, 2021 Share Posted January 8, 2021 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... 2 Link to comment Share on other sites More sharing options...
bernhard Posted January 11, 2021 Share Posted January 11, 2021 Just used $page->meta() for a simple maillog that shows when (date/time) a mail was sent for the currently edited page (invoice) and to whom (mail address) ? 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now