@wordpress/block-library
Version:
Block library for the WordPress editor.
24 lines (23 loc) • 959 B
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _wordpress_blocks = require("@wordpress/blocks");
let __create_template_part_id_js = require("./create-template-part-id.cjs");
// packages/block-library/src/template-part/edit/utils/map-template-part-to-block-pattern.js
/**
* This maps the properties of a template part to those of a block pattern.
* @param {Object} templatePart
* @return {Object} The template part in the shape of block pattern.
*/
function mapTemplatePartToBlockPattern(templatePart) {
return {
name: (0, __create_template_part_id_js.createTemplatePartId)(templatePart.theme, templatePart.slug),
title: templatePart.title.rendered,
blocks: (0, _wordpress_blocks.parse)(templatePart.content.raw),
templatePart
};
}
exports.mapTemplatePartToBlockPattern = mapTemplatePartToBlockPattern;
//# sourceMappingURL=map-template-part-to-block-pattern.cjs.map