@wordpress/block-library
Version:
Block library for the WordPress editor.
19 lines (18 loc) • 729 B
JavaScript
import { parse } from "@wordpress/blocks";
import { createTemplatePartId } from "./create-template-part-id.mjs";
// 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: createTemplatePartId(templatePart.theme, templatePart.slug),
title: templatePart.title.rendered,
blocks: parse(templatePart.content.raw),
templatePart
};
}
export { mapTemplatePartToBlockPattern };
//# sourceMappingURL=map-template-part-to-block-pattern.mjs.map