Skip to content

v1.1.1

Choose a tag to compare

@RostiMelk RostiMelk released this 23 Dec 19:17
· 14 commits to master since this release

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;
});