Releases: designcontainer/block-json-parser
Releases · designcontainer/block-json-parser
Release list
Fix: $theme_uri wrong value with WPML - Different languages in directories setting
Fixed issue with loading scripts and styles when using "Different languages in directories" setting in WPML.
v1.1.6
v1.1.5
Add child theme support
- New filter to identify that you want to load blocks from a child theme too. If so, the child theme block path is set as the primary path, and then the primary theme block folder is set as a secondary path. All blocks in these directories are loaded.
Fix php error when site does not include dc_person post type
Merge pull request #3 from designcontainer/hotfix/php-error-dc-person Fix for php error if dc_person not defined.
Moved init function to acf/init hook
- This was done so that all custom post types initialised and could be used by the filters
v1.1.1
This release contains the following:
Utility function for caching static data, such as icons.
Usage example:
add_filter('block_json_parser_block_args', function ($args) {
if (isset($args['icon']) && function_exists('material_icon')) :
// This acts as the file name for the cached data
$key = $args['icon'] . '.svg';
if ($cached_icon = block_json_parser_cache_static($key)) {
$args['icon'] = $cached_icon;
} else {
$icon_data = material_icon($args['icon']);
// This will cache the content and return the data back
$args['icon'] = block_json_parser_cache_static($key, $icon_data);
}
endif;
return $args;
});v1.1.0
This release contains the following:
- Added filter for modifying default block args:
block_json_parser_block_defaults
// Example of setting a default block category for blocks.
add_filter('block_json_parser_block_defaults', function($args) {
$args['category'] = 'your_category';
return $args;
});- Added filter for modifying block args:
block_json_parser_block_args
// Example of handling block icons with a custom function.
add_filter('block_json_parser_block_args', function($args) {
if ( isset( $args['icon'] ) && function_exists('material_icon') ) :
$args['icon'] = material_icon($args['icon']);
endif;
return $args;
});- Removed references to internal function:
material_icon(). - Removed company block defaults in favour of filter.