Jump to content
chrizz

Store WireArray in a field

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!

Share this post


Link to post
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

Share this post


Link to post
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 😉

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...