corvée(dépendances) ajoute Carbon Fields
This commit is contained in:
parent
135cc65eed
commit
62368587e5
459 changed files with 72750 additions and 26 deletions
41
web/vendor/htmlburger/carbon-fields/packages/blocks/components/block-save/index.js
vendored
Normal file
41
web/vendor/htmlburger/carbon-fields/packages/blocks/components/block-save/index.js
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* External dependencies.
|
||||
*/
|
||||
import { Component } from '@wordpress/element';
|
||||
import { InnerBlocks } from '@wordpress/editor';
|
||||
|
||||
class BlockSave extends Component {
|
||||
/**
|
||||
* Render the component.
|
||||
*
|
||||
* @return {null}
|
||||
*/
|
||||
render() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the content of inner blocks to the saved content.
|
||||
*
|
||||
* @param {mixed} element
|
||||
* @param {Object} blockType
|
||||
* @return {mixed}
|
||||
*/
|
||||
function addInnerBlocksContent( element, blockType ) {
|
||||
if ( ! /^carbon\-fields\/.+$/.test( blockType.name ) ) {
|
||||
return element;
|
||||
}
|
||||
|
||||
if ( ! blockType.supports.innerBlocks ) {
|
||||
return element;
|
||||
}
|
||||
|
||||
return (
|
||||
<InnerBlocks.Content />
|
||||
);
|
||||
}
|
||||
|
||||
wp.hooks.addFilter( 'blocks.getSaveElement', 'carbon-fields/blocks', addInnerBlocksContent );
|
||||
|
||||
export default BlockSave;
|
||||
Loading…
Add table
Add a link
Reference in a new issue