Convert Replicator fields to Bard fields
Bard fields are just like Replicator fields, except that the “text” blocks are implied and saved as text
in your content.
For example you may have a Replicator field in your fieldset where you use your “text” set like this:
fields:
story:
type: replicator
sets:
content: # The "text" set. It's the one with just a single text based field.
fields:
html:
type: redactor
quote:
fields:
quote:
type: text
cite:
type: text
and your data would be saved like this:
story:
-
type: text
html: "<p>This is my story</p>"
-
type: quote
quote: Oh Hai Mark
cite: Tommy Wiseau
To change to Bard, you’d need to replace your content
/html
set to text
/text
.
story:
-
type: text
text: "<p>This is my story</p>"
-
type: quote
quote: Oh Hai Mark
cite: Tommy Wiseau
Simple enough, but tedious to do it for all your entries.
If you happened to already call your text set text
with a field named text
- you’re in luck and don’t need to change anything.
Note: This modifies your data, so consider making a backup first.
Another Note: This doesn’t support multiple locales yet.
Download this repo and place it in site/addons/Bardify
and run this command:
php please bardify
It will automate the following:
type: replicator
to type: bard
. (Wow!)markdown: true
to the Bard field.You may also convert your content
field (the text below your YAML front-matter) into a Bard field by running the following command:
php please bardify:content
It will automate the following:
markdown: true
to the Bard field.