@wordpress/block-library
Version:
Block library for the WordPress editor.
30 lines (27 loc) • 863 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mapTemplatePartToBlockPattern = mapTemplatePartToBlockPattern;
var _blocks = require("@wordpress/blocks");
var _createTemplatePartId = require("./create-template-part-id");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* 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, _createTemplatePartId.createTemplatePartId)(templatePart.theme, templatePart.slug),
title: templatePart.title.rendered,
blocks: (0, _blocks.parse)(templatePart.content.raw),
templatePart
};
}
//# sourceMappingURL=map-template-part-to-block-pattern.js.map
;