Jump to content

Store WireArray in a field


chrizz
 Share

Recommended Posts

I was wondering if there's a PW-way to store a WireArray permanently in a field and restore the WireArray whenever needed. Currently I can only think of (un)serialize or getArray() and then storing the array as JSON. 

It there's no better way - fine. If there is something more PW-related, I'd be happy if you share it ?

Thanks!

Link to comment
Share on other sites

For any kind of non-php based storage (a.k.a. any long lived one) you need to serialize the data somehow. The simplest and most dangerous is php's serialize, json is an option or implementing a custom fieldtype, which is probably the most work depending on what you're actually storing in the wirearray.

On 5/13/2019 at 10:30 PM, elabx said:

… but it can handle normal arrays and PageArrays if that works. 

Afaik it handles PageArrays by only storing the page ids and recreating the PageArray on load.

  • Thanks 1
Link to comment
Share on other sites

thanks for your input. I think serializing is the way to go for now. The closest pw-way would be probably to create new templates holding all the data, but for now this would be overkill ?

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...