Hi!
I make a conversion from wordpress (old post) to kirby (old and new post). My old text filed are in kt(), new post are in blocks. I use this trick :
if(is_array(json_decode($page->text()))): /* and more code */
It’s OK, but if I edit an old post, I loose my text paragraph.
How to batch convert text field kt post.txt
to blocks ?
Is it possible to update and save in .txt a field value from
Text : lorem ipsum
to
Text: [{"content":{"text":"<p>lorem ipsum<\/p>","dropcap":"false"},"id":"d1f70f55-4c8e-4676-ae91-6efdf362ff0e","isHidden":false,"type":"text"}]
texnixe
2
I guess these Kirbytext fields contain more than just text? Images etc.
bntwmrt
3
Yes.
I found how to make an hook with a plugin…
So I need to know how to convert kt to block… maybe on page before edit.
- grab the text field
- convert to array and object (how get an id ?)
- update the text field
Maybe Markdown is possible…
Text: [{"content":{"text":"<p>lorem ipsum<\/p>","dropcap":"false"},"id":"d1f70f55-4c8e-4676-ae91-6efdf362ff0e","isHidden":false,"type":"markdown"}]
texnixe
4
1 Like
bntwmrt
5
Yes, I found this few minutes ago