diff --git a/includes/blocks/class-displayfeaturedimagegenesis-blocks.php b/includes/blocks/class-displayfeaturedimagegenesis-blocks.php
deleted file mode 100644
index 2de54ca..0000000
--- a/includes/blocks/class-displayfeaturedimagegenesis-blocks.php
+++ /dev/null
@@ -1,261 +0,0 @@
-register_script_style();
- foreach ( $this->blocks() as $block => $data ) {
- if ( 'term' === $block ) {
- continue;
- }
- register_block_type(
- "display-featured-image-genesis/{$block}",
- array(
- 'editor_script' => 'displayfeaturedimagegenesis-block',
- 'attributes' => $this->get_attributes( $block ),
- 'render_callback' => array( $this, 'render' ),
- )
- );
- }
- add_action( 'enqueue_block_editor_assets', array( $this, 'localize' ) );
- }
-
- /**
- * Register the block script and style.
- */
- public function register_script_style() {
- $version = displayfeaturedimagegenesis_get()->version;
- $minify = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : ' . min';
- if ( ! $minify ) {
- $version .= current_time( 'gmt' );
- }
- wp_register_script(
- 'displayfeaturedimagegenesis-block',
- plugin_dir_url( dirname( __FILE__ ) ) . "js/block{$minify}.js",
- array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' ),
- $version,
- false
- );
- }
-
- /**
- * Get the list of blocks to create.
- * @return array
- */
- private function blocks() {
- return array(
- 'term' => array(
- 'title' => __( 'Display Featured Term Image', 'display-featured-image-genesis' ),
- 'description' => __( 'Display a featured term', 'display-featured-image-genesis' ),
- 'keywords' => array(
- __( 'Term', 'display-featured-image-genesis' ),
- __( 'Featured Image', 'display-featured-image-genesis' ),
- ),
- ),
- 'author' => array(
- 'title' => __( 'Display Featured Author Profile', 'display-featured-image-genesis' ),
- 'description' => __( 'Display a featured author', 'display-featured-image-genesis' ),
- 'keywords' => array(
- __( 'Author', 'display-featured-image-genesis' ),
- __( 'Featured Image', 'display-featured-image-genesis' ),
- ),
- ),
- 'post-type' => array(
- 'title' => __( 'Display Featured Post Type Archive Image', 'display-featured-image-genesis' ),
- 'description' => __( 'Display a featured content type', 'display-featured-image-genesis' ),
- 'keywords' => array(
- __( 'Post Type', 'display-featured-image-genesis' ),
- __( 'Featured Image', 'display-featured-image-genesis' ),
- ),
- ),
- );
- }
-
- /**
- * Render the widget in a container div.
- *
- * @param $attributes
- *
- * @return string
- */
- public function render( $attributes ) {
- rgc_error_log( $attributes );
-// $classes = $this->get_block_classes( $attributes );
-// $output = '
';
-//// $output .= $this->register->shortcode( $attributes );
-// $output .= '
';
-
- return 'this is the output';
- }
-
- /**
- * Get the block classes.
- *
- * @param $attributes
- *
- * @return array
- * @since 0.4.0
- */
- private function get_block_classes( $attributes ) {
- $classes = array(
- 'wp-block-displayfeaturedimagegenesis' . 'term',
- );
- if ( ! empty( $attributes['className'] ) ) {
- $classes[] = $attributes['className'];
- }
- if ( ! empty( $attributes['blockAlignment'] ) ) {
- $classes[] = 'align' . $attributes['blockAlignment'];
- }
-
- return $classes;
- }
-
- /**
- * @param $block
- *
- * @return array
- */
- protected function get_attributes( $block ) {
- $attributes = array_merge(
- $this->fields(),
- $this->get_block_fields( $block )
- );
- foreach ( $attributes as $key => $value ) {
- $attributes[ $key ] = $this->get_individual_field_attributes( $value, $key );
- }
-
- return $attributes;
- }
-
- /**
- *
- */
- public function localize() {
- $args = array();
- foreach ( $this->blocks() as $block => $data ) {
- $args[ $block ] = $this->get_localization_data( $block, $data );
- }
- wp_localize_script( 'displayfeaturedimagegenesis-block', 'DisplayFeaturedImageGenesisBlock', $args );
- }
-
- /**
- * Get the data for localizing everything.
- *
- * @param $block
- * @param $data
- *
- * @return array
- */
- protected function get_localization_data( $block, $data ) {
- return array(
- 'block' => "displayfeaturedimagegenesis/{$block}",
- 'title' => $data['title'],
- 'description' => $data['description'],
- 'keywords' => $data['keywords'],
- 'panels' => array(
- 'main' => array(
- 'title' => __( 'Block Settings', 'display-featured-image-genesis' ),
- 'initialOpen' => true,
- 'attributes' => $this->get_attributes( $block ),
- ),
- ),
- 'icon' => 'format-image',
- 'category' => 'widgets',
- );
- }
-
- /**
- * @return array
- */
- private function fields() {
- return array(
- 'blockAlignment' => array(
- 'type' => 'string',
- 'default' => '',
- ),
- 'className' => array(
- 'type' => 'string',
- 'default' => '',
- ),
- 'title' => array(
- 'type' => 'string',
- 'default' => '',
- 'label' => __( 'Title', 'display-featured-image-genesis' ),
- ),
- 'show_image' => array(
- 'type' => 'boolean',
- 'default' => 1,
- 'label' => __( 'Show Featured Image', 'display-featured-image-genesis' ),
- 'method' => 'checkbox',
- ),
- 'image_size' => array(
- 'type' => 'string',
- 'default' => 'medium',
- 'label' => __( 'Image Size:', 'display-featured-image-genesis' ),
- 'method' => 'select',
- 'choices' => $this->get_image_size(),
- ),
- );
- }
-
- /**
- * Get an array of attributes for an individual field.
- *
- * @param $field
- * @param $id
- *
- * @return array
- */
- protected function get_individual_field_attributes( $field, $id ) {
- $field_type = $field['type'];
- if ( empty( $field['label'] ) ) {
- return $field;
- }
- $attributes = array(
- 'type' => $field['type'],
- 'default' => $field['default'],
- 'label' => $field['label'],
- 'method' => empty( $field['method'] ) ? 'text' : $field['method'],
- );
- if ( in_array( 'number', array( $field_type, $attributes['method'] ), true ) ) {
- $attributes['min'] = $field['args']['min'];
- $attributes['max'] = $field['args']['max'];
- } elseif ( 'select' === $attributes['method'] ) {
- foreach ( $field['choices'] as $value => $label ) {
- $attributes['options'][] = array(
- 'value' => $value,
- 'label' => $label,
- );
- }
- } elseif ( 'boolean' === $field_type ) {
- $attributes['default'] = 0;
- }
-
- return $attributes;
- }
-
- private function get_image_size() {
- $sizes = genesis_get_image_sizes();
- $options = array();
- foreach ( (array) $sizes as $name => $size ) {
- $options[ $name ] = sprintf( '%s ( %s x %s )', esc_html( $name ), (int) $size['width'], (int) $size['height'] );
- }
-
- return $options;
- }
-
- /**
- * @param $block
- *
- * @return array
- */
- private function get_block_fields( $block ) {
- return array();
- }
-}
diff --git a/includes/class-displayfeaturedimagegenesis.php b/includes/class-displayfeaturedimagegenesis.php
index 5735ef6..7b48c19 100644
--- a/includes/class-displayfeaturedimagegenesis.php
+++ b/includes/class-displayfeaturedimagegenesis.php
@@ -254,9 +254,6 @@ class Display_Featured_Image_Genesis {
if ( ! function_exists( 'register_block_type' ) ) {
return;
}
-// include_once 'blocks/class-displayfeaturedimagegenesis-blocks.php';
-// $blocks = new DisplayFeaturedImageGenesisBlocks();
-// $blocks->init();
include_once 'widgets/class-displayfeaturedimagegenesis-output-block.php';
$block = new DisplayFeaturedImageGenesisOutputBlock();
$block->init();
diff --git a/includes/js/block.js b/includes/js/block.js
index 1dd7b11..f6a8ea4 100644
--- a/includes/js/block.js
+++ b/includes/js/block.js
@@ -4,22 +4,24 @@
(function ( wp, undefined ) {
'use strict';
- const DisplayFeaturedImageBlockObject = {
+ const DFIGBlockObject = {
el: wp.element.createElement,
};
- DisplayFeaturedImageBlockObject.takeTwo = function ( block ) {
+ /**
+ * Initialize and register the block.
+ */
+ DFIGBlockObject.init = function ( params ) {
const registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
- InspectorControls = wp.blockEditor.InspectorControls;
- const data = DisplayFeaturedImageBlockObject.params[block];
- // console.log( data );
- registerBlockType( data.block, {
- title: data.title,
- description: data.description,
- keywords: data.keywords,
- icon: data.icon,
- category: data.category,
+ InspectorControls = wp.editor.InspectorControls;
+
+ registerBlockType( params.block, {
+ title: params.title,
+ description: params.description,
+ keywords: params.keywords,
+ icon: params.icon,
+ category: params.category,
supports: {
html: false
},
@@ -34,17 +36,17 @@
setAttributes
} = props,
Fragment = wp.element.Fragment,
- BlockControls = wp.blockEditor.BlockControls,
- BlockAlignmentToolbar = wp.blockEditor.BlockAlignmentToolbar;
+ BlockControls = wp.editor.BlockControls,
+ BlockAlignmentToolbar = wp.editor.BlockAlignmentToolbar;
return [
- DisplayFeaturedImageBlockObject.el( ServerSideRender, {
- block: data.block,
- attributes: data.attributes
+ DFIGBlockObject.el( ServerSideRender, {
+ block: params.block,
+ attributes: attributes
} ),
- DisplayFeaturedImageBlockObject.el( Fragment, null,
- DisplayFeaturedImageBlockObject.el( BlockControls, null,
- DisplayFeaturedImageBlockObject.el( BlockAlignmentToolbar, {
- value: props.attributes.blockAlignment,
+ DFIGBlockObject.el( Fragment, null,
+ DFIGBlockObject.el( BlockControls, null,
+ DFIGBlockObject.el( BlockAlignmentToolbar, {
+ value: attributes.blockAlignment,
controls: ['wide', 'full'],
onChange: ( value ) => {
setAttributes( {blockAlignment: value} );
@@ -52,8 +54,8 @@
} )
),
),
- DisplayFeaturedImageBlockObject.el( InspectorControls, {},
- _getPanels( props, block )
+ DFIGBlockObject.el( InspectorControls, {},
+ _getPanels( props, params )
)
];
},
@@ -68,20 +70,20 @@
* Get the panels for the block controls.
*
* @param props
- * @param block
+ * @param params
* @return {Array}
* @private
*/
- function _getPanels( props, block ) {
+ function _getPanels( props, params ) {
const panels = [],
PanelBody = wp.components.PanelBody;
- const blockData = DisplayFeaturedImageBlockObject.params[block];
- Object.keys( blockData.panels ).forEach( function ( key, index ) {
- if ( blockData.panels.hasOwnProperty( key ) ) {
- const IndividualPanel = blockData.panels[key];
- panels[index] = DisplayFeaturedImageBlockObject.el( PanelBody, {
+ Object.keys( params.panels ).forEach( function ( key, index ) {
+ if ( params.panels.hasOwnProperty( key ) ) {
+ const IndividualPanel = params.panels[key];
+ panels[index] = DFIGBlockObject.el( PanelBody, {
title: IndividualPanel.title,
- initialOpen: IndividualPanel.initialOpen
+ initialOpen: IndividualPanel.initialOpen,
+ className: 'scriptless-panel-' + key
}, _getControls( props, IndividualPanel.attributes ) );
}
} );
@@ -107,7 +109,7 @@
}
const IndividualField = fields[key],
control = _getControlType( IndividualField.method, IndividualField.type );
- controls[index] = DisplayFeaturedImageBlockObject.el( control, _getIndividualControl( key, IndividualField, props ) );
+ controls[index] = DFIGBlockObject.el( control, _getIndividualControl( key, IndividualField, props ) );
}
} );
@@ -156,7 +158,6 @@
function _getIndividualControl( key, field, props ) {
const {attributes, setAttributes} = props;
const control = {
- heading: field.heading,
label: field.label,
value: attributes[key],
className: 'displayfeaturedimagegenesis-' + key,
@@ -182,9 +183,13 @@
return control;
}
- DisplayFeaturedImageBlockObject.params = typeof DisplayFeaturedImageGenesisBlock === 'undefined' ? '' : DisplayFeaturedImageGenesisBlock;
+ DFIGBlockObject.params = typeof DisplayFeaturedImageBlock === 'undefined' ? '' : DisplayFeaturedImageBlock;
- if ( typeof DisplayFeaturedImageBlockObject.params !== 'undefined' ) {
- DisplayFeaturedImageBlockObject.takeTwo( 'post-type' );
+ if ( typeof DFIGBlockObject.params !== 'undefined' ) {
+ Object.keys( DFIGBlockObject.params ).forEach( function ( key, index ) {
+ if ( DFIGBlockObject.params.hasOwnProperty( key ) ) {
+ DFIGBlockObject.init( DFIGBlockObject.params[ key ] );
+ }
+ } );
}
} )( wp );
diff --git a/includes/js/block.min.js b/includes/js/block.min.js
index e396e57..cc89cca 100644
--- a/includes/js/block.min.js
+++ b/includes/js/block.min.js
@@ -1 +1 @@
-!function(e,t){"use strict";const n={el:e.element.createElement};n.takeTwo=function(t){const o=e.blocks.registerBlockType,l=e.components.ServerSideRender,i=e.blockEditor.InspectorControls,r=n.params[t];o(r.block,{title:r.title,description:r.description,keywords:r.keywords,icon:r.icon,category:r.category,supports:{html:!1},getEditWrapperProps:({blockAlignment:e})=>({"data-align":e}),edit:o=>{const{attributes:s,setAttributes:a}=o,c=e.element.Fragment,u=e.blockEditor.BlockControls,m=e.blockEditor.BlockAlignmentToolbar;return[n.el(l,{block:r.block,attributes:r.attributes}),n.el(c,null,n.el(u,null,n.el(m,{value:o.attributes.blockAlignment,controls:["wide","full"],onChange:e=>{a({blockAlignment:e})}}))),n.el(i,{},function(t,o){const l=[],i=e.components.PanelBody,r=n.params[o];return Object.keys(r.panels).forEach(function(o,s){if(r.panels.hasOwnProperty(o)){const a=r.panels[o];l[s]=n.el(i,{title:a.title,initialOpen:a.initialOpen},function(t,o){const l=[];return Object.keys(o).forEach(function(i,r){if(o.hasOwnProperty(i)){if(-1!==["blockAlignment","className"].indexOf(i))return;const s=o[i],a=function(t,n){const{TextControl:o,SelectControl:l,RangeControl:i,CheckboxControl:r,TextareaControl:s}=e.components,a=o;return"select"===t?l:"number"===t&&"number"===n?i:"checkbox"===t?r:"textarea"===t?s:a}(s.method,s.type);l[r]=n.el(a,function(e,t,n){const{attributes:o,setAttributes:l}=n,i={heading:t.heading,label:t.label,value:o[e],className:"displayfeaturedimagegenesis-"+e,onChange:t=>{l({[e]:t})}};return"select"===t.method?i.options=t.options:"number"===t.method?(i.min=t.min,i.max=t.max,"number"!==t.type?i.type="number":i.initialPosition=t.min):"checkbox"===t.method&&(i.checked=o[e]),i}(i,s,t))}}),l}(t,a.attributes))}}),l}(o,t))]},save:e=>null})},n.params="undefined"==typeof DisplayFeaturedImageGenesisBlock?"":DisplayFeaturedImageGenesisBlock,void 0!==n.params&&n.takeTwo("post-type")}(wp);
\ No newline at end of file
+!function(e,t){"use strict";const n={el:e.element.createElement};n.init=function(t){const o=e.blocks.registerBlockType,l=e.components.ServerSideRender,r=e.editor.InspectorControls;o(t.block,{title:t.title,description:t.description,keywords:t.keywords,icon:t.icon,category:t.category,supports:{html:!1},getEditWrapperProps:({blockAlignment:e})=>({"data-align":e}),edit:o=>{const{attributes:i,setAttributes:s}=o,a=e.element.Fragment,c=e.editor.BlockControls,m=e.editor.BlockAlignmentToolbar;return[n.el(l,{block:t.block,attributes:i}),n.el(a,null,n.el(c,null,n.el(m,{value:i.blockAlignment,controls:["wide","full"],onChange:e=>{s({blockAlignment:e})}}))),n.el(r,{},function(t,o){const l=[],r=e.components.PanelBody;return Object.keys(o.panels).forEach(function(i,s){if(o.panels.hasOwnProperty(i)){const a=o.panels[i];l[s]=n.el(r,{title:a.title,initialOpen:a.initialOpen,className:"scriptless-panel-"+i},function(t,o){const l=[];return Object.keys(o).forEach(function(r,i){if(o.hasOwnProperty(r)){if(-1!==["blockAlignment","className"].indexOf(r))return;const s=o[r],a=function(t,n){const{TextControl:o,SelectControl:l,RangeControl:r,CheckboxControl:i,TextareaControl:s}=e.components,a=o;return"select"===t?l:"number"===t&&"number"===n?r:"checkbox"===t?i:"textarea"===t?s:a}(s.method,s.type);l[i]=n.el(a,function(e,t,n){const{attributes:o,setAttributes:l}=n,r={label:t.label,value:o[e],className:"displayfeaturedimagegenesis-"+e,onChange:t=>{l({[e]:t})}};return"select"===t.method?r.options=t.options:"number"===t.method?(r.min=t.min,r.max=t.max,"number"!==t.type?r.type="number":r.initialPosition=t.min):"checkbox"===t.method&&(r.checked=o[e]),r}(r,s,t))}}),l}(t,a.attributes))}}),l}(o,t))]},save:e=>null})},n.params="undefined"==typeof DisplayFeaturedImageBlock?"":DisplayFeaturedImageBlock,void 0!==n.params&&Object.keys(n.params).forEach(function(e,t){n.params.hasOwnProperty(e)&&n.init(n.params[e])})}(wp);
\ No newline at end of file
diff --git a/includes/js/test-block.js b/includes/js/test-block.js
deleted file mode 100644
index ec702e5..0000000
--- a/includes/js/test-block.js
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2019 Robin Cornett
- */
-
-(function ( wp, undefined ) {
- 'use strict';
- const DFIGBlockObject = {
- el: wp.element.createElement,
- };
-
- /**
- * Initialize and register the block.
- */
- DFIGBlockObject.init = function ( params ) {
- const registerBlockType = wp.blocks.registerBlockType,
- ServerSideRender = wp.components.ServerSideRender,
- InspectorControls = wp.editor.InspectorControls;
-
- registerBlockType( params.block, {
- title: params.title,
- description: params.description,
- keywords: params.keywords,
- icon: params.icon,
- category: params.category,
- supports: {
- html: false
- },
-
- getEditWrapperProps( {blockAlignment} ) {
- return {'data-align': blockAlignment};
- },
-
- edit: props => {
- const {
- attributes,
- setAttributes
- } = props,
- Fragment = wp.element.Fragment,
- BlockControls = wp.editor.BlockControls,
- BlockAlignmentToolbar = wp.editor.BlockAlignmentToolbar;
- return [
- DFIGBlockObject.el( ServerSideRender, {
- block: params.block,
- attributes: attributes
- } ),
- DFIGBlockObject.el( Fragment, null,
- DFIGBlockObject.el( BlockControls, null,
- DFIGBlockObject.el( BlockAlignmentToolbar, {
- value: attributes.blockAlignment,
- controls: ['wide', 'full'],
- onChange: ( value ) => {
- setAttributes( {blockAlignment: value} );
- },
- } )
- ),
- ),
- DFIGBlockObject.el( InspectorControls, {},
- _getPanels( props, params )
- )
- ];
- },
-
- save: props => {
- return null;
- },
- } );
- };
-
- /**
- * Get the panels for the block controls.
- *
- * @param props
- * @param params
- * @return {Array}
- * @private
- */
- function _getPanels( props, params ) {
- const panels = [],
- PanelBody = wp.components.PanelBody;
- Object.keys( params.panels ).forEach( function ( key, index ) {
- if ( params.panels.hasOwnProperty( key ) ) {
- const IndividualPanel = params.panels[key];
- panels[index] = DFIGBlockObject.el( PanelBody, {
- title: IndividualPanel.title,
- initialOpen: IndividualPanel.initialOpen,
- className: 'scriptless-panel-' + key
- }, _getControls( props, IndividualPanel.attributes ) );
- }
- } );
-
- return panels;
- }
-
- /**
- * Get all of the block controls, with defaults and options.
- *
- * @param props
- * @param fields
- * @return {Array}
- * @private
- */
- function _getControls( props, fields ) {
- const controls = [];
- Object.keys( fields ).forEach( function ( key, index ) {
- if ( fields.hasOwnProperty( key ) ) {
- var skipped = [ 'blockAlignment', 'className' ];
- if ( -1 !== skipped.indexOf( key ) ) {
- return;
- }
- const IndividualField = fields[key],
- control = _getControlType( IndividualField.method, IndividualField.type );
- controls[index] = DFIGBlockObject.el( control, _getIndividualControl( key, IndividualField, props ) );
- }
- } );
-
- return controls;
- }
-
- /**
- * Get the control type.
- * @param method
- * @param control_type
- * @return {*}
- * @private
- */
- function _getControlType( method, control_type ) {
- const {
- TextControl,
- SelectControl,
- RangeControl,
- CheckboxControl,
- TextareaControl
- } = wp.components;
- const control = TextControl;
- if ( 'select' === method ) {
- return SelectControl;
- } else if ( 'number' === method && 'number' === control_type ) {
- return RangeControl;
- } else if ( 'checkbox' === method ) {
- return CheckboxControl;
- } else if ( 'textarea' === method ) {
- return TextareaControl;
- }
-
- return control;
- }
-
- /**
- * Build the individual control object. Sets up standard properties for all
- * controls; then adds custom properties as needed.
- *
- * @param key
- * @param field
- * @param props
- * @return {{label: *, value: *, className: string, onChange: onChange}}
- * @private
- */
- function _getIndividualControl( key, field, props ) {
- const {attributes, setAttributes} = props;
- const control = {
- label: field.label,
- value: attributes[key],
- className: 'displayfeaturedimagegenesis-' + key,
- onChange: ( value ) => {
- setAttributes( {[key]: value} );
- }
- };
-
- if ( 'select' === field.method ) {
- control.options = field.options;
- } else if ( 'number' === field.method ) {
- control.min = field.min;
- control.max = field.max;
- if ( 'number' !== field.type ) {
- control.type = 'number';
- } else {
- control.initialPosition = field.min;
- }
- } else if ( 'checkbox' === field.method ) {
- control.checked = attributes[key];
- }
-
- return control;
- }
-
- DFIGBlockObject.params = typeof DisplayFeaturedImageTestBlock === 'undefined' ? '' : DisplayFeaturedImageTestBlock;
-
- if ( typeof DFIGBlockObject.params !== 'undefined' ) {
- Object.keys( DFIGBlockObject.params ).forEach( function ( key, index ) {
- if ( DFIGBlockObject.params.hasOwnProperty( key ) ) {
- DFIGBlockObject.init( DFIGBlockObject.params[ key ] );
- }
- } );
- }
-} )( wp );
diff --git a/includes/js/test-block.min.js b/includes/js/test-block.min.js
deleted file mode 100644
index 6d2f3dd..0000000
--- a/includes/js/test-block.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(e,t){"use strict";const n={el:e.element.createElement};n.init=function(t){const o=e.blocks.registerBlockType,l=e.components.ServerSideRender,r=e.editor.InspectorControls;o(t.block,{title:t.title,description:t.description,keywords:t.keywords,icon:t.icon,category:t.category,supports:{html:!1},getEditWrapperProps:({blockAlignment:e})=>({"data-align":e}),edit:o=>{const{attributes:i,setAttributes:s}=o,a=e.element.Fragment,c=e.editor.BlockControls,m=e.editor.BlockAlignmentToolbar;return[n.el(l,{block:t.block,attributes:i}),n.el(a,null,n.el(c,null,n.el(m,{value:i.blockAlignment,controls:["wide","full"],onChange:e=>{s({blockAlignment:e})}}))),n.el(r,{},function(t,o){const l=[],r=e.components.PanelBody;return Object.keys(o.panels).forEach(function(i,s){if(o.panels.hasOwnProperty(i)){const a=o.panels[i];l[s]=n.el(r,{title:a.title,initialOpen:a.initialOpen,className:"scriptless-panel-"+i},function(t,o){const l=[];return Object.keys(o).forEach(function(r,i){if(o.hasOwnProperty(r)){if(-1!==["blockAlignment","className"].indexOf(r))return;const s=o[r],a=function(t,n){const{TextControl:o,SelectControl:l,RangeControl:r,CheckboxControl:i,TextareaControl:s}=e.components,a=o;return"select"===t?l:"number"===t&&"number"===n?r:"checkbox"===t?i:"textarea"===t?s:a}(s.method,s.type);l[i]=n.el(a,function(e,t,n){const{attributes:o,setAttributes:l}=n,r={label:t.label,value:o[e],className:"displayfeaturedimagegenesis-"+e,onChange:t=>{l({[e]:t})}};return"select"===t.method?r.options=t.options:"number"===t.method?(r.min=t.min,r.max=t.max,"number"!==t.type?r.type="number":r.initialPosition=t.min):"checkbox"===t.method&&(r.checked=o[e]),r}(r,s,t))}}),l}(t,a.attributes))}}),l}(o,t))]},save:e=>null})},n.params="undefined"==typeof DisplayFeaturedImageTestBlock?"":DisplayFeaturedImageTestBlock,void 0!==n.params&&Object.keys(n.params).forEach(function(e,t){n.params.hasOwnProperty(e)&&n.init(n.params[e])})}(wp);
\ No newline at end of file
diff --git a/includes/widgets/class-displayfeaturedimagegenesis-output-block.php b/includes/widgets/class-displayfeaturedimagegenesis-output-block.php
index 5c30912..0bbcfee 100644
--- a/includes/widgets/class-displayfeaturedimagegenesis-output-block.php
+++ b/includes/widgets/class-displayfeaturedimagegenesis-output-block.php
@@ -138,7 +138,7 @@ class DisplayFeaturedImageGenesisOutputBlock {
}
wp_register_script(
"{$this->block}block",
- plugin_dir_url( dirname( __FILE__ ) ) . "js/test-block{$minify}.js",
+ plugin_dir_url( dirname( __FILE__ ) ) . "js/block{$minify}.js",
array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' ),
$version,
false
@@ -149,7 +149,7 @@ class DisplayFeaturedImageGenesisOutputBlock {
* Localize.
*/
public function localize() {
- wp_localize_script( "{$this->block}block", 'DisplayFeaturedImageTestBlock', $this->get_localization_data() );
+ wp_localize_script( "{$this->block}block", 'DisplayFeaturedImageBlock', $this->get_localization_data() );
}
/**