most block lists to json files
This commit is contained in:
@@ -103,59 +103,7 @@ add_action('init', function () {
|
|||||||
'style' => "{$slug}-style",
|
'style' => "{$slug}-style",
|
||||||
'script' => "{$slug}-script",
|
'script' => "{$slug}-script",
|
||||||
'view_script' => "{$slug}-view-script",
|
'view_script' => "{$slug}-view-script",
|
||||||
'attributes' => [
|
'attributes' => attributes(),
|
||||||
'container_width' => [
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => '',
|
|
||||||
],
|
|
||||||
'alignment' => [
|
|
||||||
'type' => 'string',
|
|
||||||
],
|
|
||||||
'padding_top' => [
|
|
||||||
'type' => 'boolean',
|
|
||||||
'default' => true
|
|
||||||
],
|
|
||||||
'padding_bottom' => [
|
|
||||||
'type' => 'boolean',
|
|
||||||
'default' => true
|
|
||||||
],
|
|
||||||
'background_colour' => [
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => '',
|
|
||||||
],
|
|
||||||
'background_hex' => [
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => '',
|
|
||||||
],
|
|
||||||
'background_tint' => [
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => '0',
|
|
||||||
],
|
|
||||||
'background_image' => [
|
|
||||||
'type' => 'integer',
|
|
||||||
'default' => 0,
|
|
||||||
],
|
|
||||||
'background_url' => [
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => '',
|
|
||||||
],
|
|
||||||
'background_opacity' => [
|
|
||||||
'type' => 'integer',
|
|
||||||
'default' => 30
|
|
||||||
],
|
|
||||||
'background_position' => [
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => '',
|
|
||||||
],
|
|
||||||
'background_fixed' => [
|
|
||||||
'type' => 'boolean',
|
|
||||||
'default' => false,
|
|
||||||
],
|
|
||||||
'background_contrast' => [
|
|
||||||
'type' => 'boolean',
|
|
||||||
'default' => false,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if(!property_exists($json, 'acf') && \Roots\view()->exists("blocks.{$slug}.render")) {
|
if(!property_exists($json, 'acf') && \Roots\view()->exists("blocks.{$slug}.render")) {
|
||||||
@@ -176,12 +124,20 @@ add_action('init', function () {
|
|||||||
|
|
||||||
function list_inner()
|
function list_inner()
|
||||||
{
|
{
|
||||||
$file = file_get_contents(get_theme_file_path("resources/json/core-block-whitelist.json"));
|
$file = file_get_contents(get_theme_file_path("resources/json/block-core-whitelist.json"));
|
||||||
$json = json_decode($file);
|
$json = json_decode($file);
|
||||||
|
|
||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function attributes()
|
||||||
|
{
|
||||||
|
$file = file_get_contents(get_theme_file_path("resources/json/block-attributes.json"));
|
||||||
|
$json = json_decode($file, true);
|
||||||
|
|
||||||
|
return $json;
|
||||||
|
}
|
||||||
|
|
||||||
function list_all()
|
function list_all()
|
||||||
{
|
{
|
||||||
$blocks = array_map(function($block) {
|
$blocks = array_map(function($block) {
|
||||||
|
|||||||
53
web/app/themes/badegg/resources/json/block-attributes.json
Normal file
53
web/app/themes/badegg/resources/json/block-attributes.json
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"container_width": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
|
"alignment": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"padding_top": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"padding_bottom": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"background_colour": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
|
"background_hex": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
|
"background_tint": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "0"
|
||||||
|
},
|
||||||
|
"background_image": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"background_url": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
|
"background_opacity": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 30
|
||||||
|
},
|
||||||
|
"background_position": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
|
"background_fixed": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"background_contrast": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
|
}
|
||||||
4
web/app/themes/badegg/resources/json/block-parents.json
Normal file
4
web/app/themes/badegg/resources/json/block-parents.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
"acf/badegg-editor",
|
||||||
|
"badegg/article"
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user