Field Data
A table fields data and settings are stored in one serialized array in a post meta entry.
Data Structure
Here is an example of a table and the raw data stored in the database expressed as JSON. Depending on where the table field data is processed, it is a Javascript object or a PHP array.
Example table
A | B |
---|---|
1 | some |
2 | thing |
Table data object as JSON
{
"t":{ // table
"o":{ // table options
"ca":"", // caption
"ct":"ed", // content type
"tb":"basic", // toolbar for wysiwyg editor
"uh":"y", // use header
"uf":"n", // use footer
"sc":"n", // use stub column
"st":"n", // style
"cols":"2", // amount of columns
"rows":"3", // amount of columns
"changed":"true" // default table was changed
}
},
"c":[ // columns options
{ // columns row
"c": [ // column cells
{ // column
"o":{} // column options
},
{
"o":{}
}
]
},
],
"h":[ // table header
{ // header row
"c": [ // header cells
{ // a header cell
"c":"A", // a header cell content
"o":{} // a header cell options
},
{
"c":"B",
"o": {}
}
],
"o":{} // the header row options
},
],
"b":[ // table body
{ // a table body row
"c": [ // a body row cells
{
"c":"1", // a body cell content
"o":{} // a body cell options
},
{
"c":"some",
"o":{}
}
],
"o":{} // a body row options
},
{
"c": [
{
"c":"2",
"o":{}
},
{
"c":"thing",
"o":{}
}
],
"o":{}
}
],
"p":[ // parameters
"v": "1.0.0", // table field plugin version
"fk": "field_664dcdcdd4983", // ACF field key
"fn": "table" // ACF field name
],
}
Table Object
Table options structure
{
"t":{
"o":{
"uh":"y"
}
}
}
The object "t"
stands for parameters of this table. This parameter object has an object "o"
which stands for options.
Table options list
Name | Decription | Type | Value | Module |
---|---|---|---|---|
ca | Table caption | string | caption | |
changed | Whether the table content was edited | boolean | false/true | main |
uh | Use header | string | y/n | thead |
uf | Use footer | string | y/n | tfoot |
cols | Amount of the table body colums | integer | cols_rows_limit | |
rows | Amount of the table body rows | integer | cols_rows_limit | |
ct | Content type of cells | string | st/ed | cell_content_type |
tb | Toolbar for wysiwyg editor | string | full/basic | editor |
st | Style | string | table_styles | |
sc | Stub Column | string | n | stub_column |