Several updates to wrapper settings in metadata blocks. Adds icons to section blocks. #566.
This commit is contained in:
parent
bfd35abb70
commit
2eddc2a02c
|
@ -1017,7 +1017,7 @@ class Item extends Entity {
|
|||
'hide_description' => true,
|
||||
'hide_empty' => true,
|
||||
'empty_metadata_list_message' => '',
|
||||
'before' => '<section class="metadata-section-slug-$slug" id="$id">',
|
||||
'before' => '<section class="metadata-section-slug-$slug" id="metadata-section-$id">',
|
||||
'after' => '</section>',
|
||||
'before_name' => '<h2 id="metadata-section-$slug">',
|
||||
'after_name' => '</h2>',
|
||||
|
@ -1174,7 +1174,7 @@ class Item extends Entity {
|
|||
'hide_description' => true,
|
||||
'hide_empty' => true,
|
||||
'empty_metadata_list_message' => '',
|
||||
'before' => '<section class="metadata-section-slug-$slug" id="$id">',
|
||||
'before' => '<section class="metadata-section-slug-$slug" id="metadata-section-$id">',
|
||||
'after' => '</section>',
|
||||
'before_name' => '<h2 id="metadata-section-$slug">',
|
||||
'after_name' => '</h2>',
|
||||
|
|
|
@ -65,6 +65,9 @@
|
|||
"sectionMetadata": {
|
||||
"type": "array",
|
||||
"default": []
|
||||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"providesContext": {
|
||||
|
|
|
@ -3,7 +3,7 @@ const { __ } = wp.i18n;
|
|||
const { Button, Spinner, Placeholder, ToggleControl, PanelBody } = wp.components;
|
||||
|
||||
const ServerSideRender = wp.serverSideRender;
|
||||
const { useBlockProps, InnerBlocks, InspectorControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
const { useBlockProps, InnerBlocks, BlockControls, AlignmentControl, InspectorControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
import SingleItemMetadataSectionModal from '../../js/selection/single-item-metadata-section-modal.js';
|
||||
import getCollectionIdFromPossibleTemplateEdition from '../../js/template/tainacan-blocks-single-item-template-mode.js';
|
||||
|
@ -26,11 +26,16 @@ export default function ({ attributes, setAttributes, className, isSelected }) {
|
|||
metadataSectionTemplate,
|
||||
dataSource,
|
||||
templateMode,
|
||||
isDynamic
|
||||
isDynamic,
|
||||
textAlign
|
||||
} = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps();
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps( {
|
||||
className: {
|
||||
[ `has-text-align-${ textAlign }` ]: textAlign,
|
||||
}
|
||||
} );
|
||||
const currentWPVersion = (typeof tainacan_blocks != 'undefined') ? tainacan_blocks.wp_version : tainacan_plugin.wp_version;
|
||||
|
||||
function setContent() {
|
||||
|
@ -182,6 +187,15 @@ export default function ({ attributes, setAttributes, className, isSelected }) {
|
|||
</InspectorControls>
|
||||
: null }
|
||||
|
||||
<BlockControls group="block">
|
||||
<AlignmentControl
|
||||
value={ textAlign }
|
||||
onChange={ ( nextAlign ) => {
|
||||
setAttributes( { textAlign: nextAlign } );
|
||||
} }
|
||||
/>
|
||||
</BlockControls>
|
||||
|
||||
{ isSelected ?
|
||||
(
|
||||
<div>
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
export default (
|
||||
<SVG
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
viewBox="0 0 6 6"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<Path
|
||||
d="m 3.996,3.9959991 h 5.016 q 0.816,0 1.392,0.576 l 7.008,7.0079999 q 0.576,0.576 0.576,1.416 0,0.84 -0.576,1.416 l -4.992,4.992 q -0.264,0.264 -0.648,0.432 -0.36,0.168 -0.768,0.168 -0.408,0 -0.792,-0.168 -0.36,-0.168 -0.624,-0.432 l -6.984,-6.984 q -0.6,-0.6 -0.6,-1.416 V 5.9879991 q 0,-0.84 0.576,-1.416 0.576,-0.576 1.416,-0.576 z m 9.552,1.704 0.984,-0.984 6.864,6.8639999 q 0.6,0.6 0.6,1.416 0,0.84 -0.576,1.416 l -5.376,5.376 -1.008,-1.008 5.712,-5.784 z m -8.04,3.288 q 0.624,0 1.056,-0.432 0.432,-0.432 0.432,-1.056 0,-0.624 -0.432,-1.056 -0.432,-0.456 -1.056,-0.456 -0.624,0 -1.08,0.456 -0.432,0.432 -0.432,1.056 0,0.624 0.432,1.056 0.456,0.432 1.08,0.432 z"
|
||||
/>
|
||||
<Path d="m1.2849 0.84891c-0.085556 0-0.15764 0.029712-0.21631 0.088379-0.058667 0.058667-0.087891 0.13075-0.087891 0.21631v0.76611c0 0.083111 0.030686 0.1552 0.091797 0.21631l1.0669 1.0669c0.026889 0.026889 0.058548 0.049295 0.095215 0.066406 0.039111 0.017111 0.079538 0.025391 0.12109 0.025391 0.041556 0 0.080521-0.00828 0.11719-0.025391 0.039111-0.017111 0.072232-0.039518 0.099121-0.066406l0.7627-0.7627c0.058667-0.058667 0.087891-0.13075 0.087891-0.21631 0-0.085556-0.029224-0.15764-0.087891-0.21631l-1.0708-1.0703c-0.058667-0.058667-0.12929-0.088379-0.2124-0.088379zm0.21924 0.30469c0.00391-1.815e-4 0.00775 0 0.011719 0 0.063556 0 0.11762 0.022891 0.16162 0.069336 0.044 0.044 0.065918 0.098066 0.065918 0.16162 0 0.063556-0.021918 0.11713-0.065918 0.16113s-0.098066 0.065918-0.16162 0.065918c-0.063555 0-0.11859-0.021918-0.16504-0.065918-0.044-0.044-0.065918-0.097577-0.065918-0.16113 0-0.063556 0.021918-0.11762 0.065918-0.16162 0.043542-0.043542 0.09474-0.066615 0.15332-0.069336z" stroke-width=".25"/>
|
||||
<Path d="m0.98355 3.7638v0.37834h4.0357v-0.37834z" stroke-width=".25223"/>
|
||||
<Path d="m0.98355 5.1511h2.2701v-0.37836h-2.2701z" stroke-width=".25223"/>
|
||||
</SVG>
|
||||
);
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
const { useBlockProps, InnerBlocks } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
export default function({ attributes, className }) {
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps.save();
|
||||
|
||||
return attributes.isDynamic ? null : <div { ...blockProps }><InnerBlocks.Content /></div>
|
||||
export default function({ attributes }) {
|
||||
const { textAlign, isDynamic } = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: `has-text-align-${ textAlign }` } : useBlockProps.save( {
|
||||
className: `has-text-align-${ textAlign }`
|
||||
} );
|
||||
return isDynamic ? null : <div { ...blockProps }><InnerBlocks.Content /></div>
|
||||
};
|
|
@ -21,6 +21,16 @@ function tainacan_blocks_render_metadata_section( $block_attributes, $content, $
|
|||
'metadata_section' => $section_id
|
||||
];
|
||||
|
||||
// Classes from block and Text alignment
|
||||
$text_align = isset($block_attributes['textAlign']) ? $block_attributes['textAlign'] : false;
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => 'metadata-section-slug-$slug' . ( $text_align ? (' has-text-align-' . $text_align) : '' ),
|
||||
)
|
||||
);
|
||||
$args['before'] = '<section id="metadata-section-$id ' . $wrapper_attributes . '>';
|
||||
$args['after'] = '</section>';
|
||||
|
||||
if ( $template_mode && $collection_id ) {
|
||||
// Checks if we are in the edit page or in the published
|
||||
$current_post = get_post();
|
||||
|
@ -37,11 +47,20 @@ function tainacan_blocks_render_metadata_section( $block_attributes, $content, $
|
|||
|
||||
} else {
|
||||
|
||||
// Classes from block and Text alignment
|
||||
$text_align = isset($block_attributes['textAlign']) ? $block_attributes['textAlign'] : false;
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => ( $text_align ? (' has-text-align-' . $text_align) : '' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Gets inner blocks and wraps them with this parent wrapper
|
||||
$inner_blocks = $block->inner_blocks;
|
||||
$inner_blocks_html = '';
|
||||
foreach ( $inner_blocks as $inner_block ) {
|
||||
$inner_blocks_html .= $inner_block->render();
|
||||
}
|
||||
return $inner_blocks_html;
|
||||
return '<div ' . $wrapper_attributes . '>' . $inner_blocks_html . '</div>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
"metadataSectionsTemplate": {
|
||||
"type": "array",
|
||||
"default": []
|
||||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
|
|
|
@ -3,7 +3,7 @@ const { __ } = wp.i18n;
|
|||
const { Button, Spinner, Placeholder, ToggleControl, PanelBody } = wp.components;
|
||||
|
||||
const ServerSideRender = wp.serverSideRender;
|
||||
const { useBlockProps, InnerBlocks, InspectorControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
const { useBlockProps, InnerBlocks, BlockControls, AlignmentControl, InspectorControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
import SingleItemModal from '../../js/selection/single-item-modal.js';
|
||||
import getCollectionIdFromPossibleTemplateEdition from '../../js/template/tainacan-blocks-single-item-template-mode.js';
|
||||
|
@ -22,11 +22,16 @@ export default function ({ attributes, setAttributes, className, isSelected }) {
|
|||
metadataSections,
|
||||
metadataSectionsTemplate,
|
||||
templateMode,
|
||||
isDynamic
|
||||
isDynamic,
|
||||
textAlign
|
||||
} = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps();
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps( {
|
||||
className: {
|
||||
[ `has-text-align-${ textAlign }` ]: textAlign,
|
||||
}
|
||||
} );
|
||||
const currentWPVersion = (typeof tainacan_blocks != 'undefined') ? tainacan_blocks.wp_version : tainacan_plugin.wp_version;
|
||||
|
||||
function setContent() {
|
||||
|
@ -139,6 +144,15 @@ export default function ({ attributes, setAttributes, className, isSelected }) {
|
|||
</PanelBody>
|
||||
</InspectorControls>
|
||||
|
||||
<BlockControls group="block">
|
||||
<AlignmentControl
|
||||
value={ textAlign }
|
||||
onChange={ ( nextAlign ) => {
|
||||
setAttributes( { textAlign: nextAlign } );
|
||||
} }
|
||||
/>
|
||||
</BlockControls>
|
||||
|
||||
{ isSelected ?
|
||||
(
|
||||
<div>
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
export default (
|
||||
<SVG
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
viewBox="0 0 6 6"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<Path
|
||||
d="m 3.996,3.9959991 h 5.016 q 0.816,0 1.392,0.576 l 7.008,7.0079999 q 0.576,0.576 0.576,1.416 0,0.84 -0.576,1.416 l -4.992,4.992 q -0.264,0.264 -0.648,0.432 -0.36,0.168 -0.768,0.168 -0.408,0 -0.792,-0.168 -0.36,-0.168 -0.624,-0.432 l -6.984,-6.984 q -0.6,-0.6 -0.6,-1.416 V 5.9879991 q 0,-0.84 0.576,-1.416 0.576,-0.576 1.416,-0.576 z m 9.552,1.704 0.984,-0.984 6.864,6.8639999 q 0.6,0.6 0.6,1.416 0,0.84 -0.576,1.416 l -5.376,5.376 -1.008,-1.008 5.712,-5.784 z m -8.04,3.288 q 0.624,0 1.056,-0.432 0.432,-0.432 0.432,-1.056 0,-0.624 -0.432,-1.056 -0.432,-0.456 -1.056,-0.456 -0.624,0 -1.08,0.456 -0.432,0.432 -0.432,1.056 0,0.624 0.432,1.056 0.456,0.432 1.08,0.432 z"
|
||||
/>
|
||||
<Path d="m1.2849 0.84891c-0.085556 0-0.15764 0.029712-0.21631 0.088379-0.058667 0.058667-0.087891 0.13075-0.087891 0.21631v0.76611c0 0.083111 0.030686 0.1552 0.091797 0.21631l1.0669 1.0669c0.026889 0.026889 0.058548 0.049295 0.095215 0.066406 0.039111 0.017111 0.079538 0.025391 0.12109 0.025391 0.041556 0 0.080521-0.00828 0.11719-0.025391 0.039111-0.017111 0.072232-0.039518 0.099121-0.066406l0.7627-0.7627c0.058667-0.058667 0.087891-0.13075 0.087891-0.21631 0-0.085556-0.029224-0.15764-0.087891-0.21631l-1.0708-1.0703c-0.058667-0.058667-0.12929-0.088379-0.2124-0.088379zm0.21924 0.30469c0.00391-1.815e-4 0.00775 0 0.011719 0 0.063556 0 0.11762 0.022891 0.16162 0.069336 0.044 0.044 0.065918 0.098066 0.065918 0.16162 0 0.063556-0.021918 0.11713-0.065918 0.16113s-0.098066 0.065918-0.16162 0.065918c-0.063555 0-0.11859-0.021918-0.16504-0.065918-0.044-0.044-0.065918-0.097577-0.065918-0.16113 0-0.063556 0.021918-0.11762 0.065918-0.16162 0.043542-0.043542 0.09474-0.066615 0.15332-0.069336z" stroke-width=".25"/>
|
||||
<Path d="m2.7444 1.1095 0.17272-0.099996s0.031904-0.0143 0.085176-0.010025c0.046428 0.003726 0.072053 0.029979 0.072053 0.029979l0.97841 0.97841c0.061111 0.061111 0.091667 0.13322 0.091667 0.21633 0 0.085553-0.029333 0.15766-0.088 0.21633l-0.73575 0.73575s-0.033678 0.042018-0.088029 0.047173c-0.063189 0.00599-0.098573-0.020678-0.098573-0.020678l-0.16231-0.094919 0.87267-0.88367z" stroke-width=".25"/>
|
||||
<Path d="m0.98355 3.7638v0.37834h4.0357v-0.37834z" stroke-width=".25223"/>
|
||||
<Path d="m0.98355 5.1511h2.2701v-0.37836h-2.2701z" stroke-width=".25223"/>
|
||||
</SVG>
|
||||
);
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
const { useBlockProps, InnerBlocks } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
export default function({ attributes, className }) {
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps.save();
|
||||
|
||||
return attributes.isDynamic ? null : <div { ...blockProps }><InnerBlocks.Content /></div>
|
||||
export default function({ attributes }) {
|
||||
const { textAlign, isDynamic } = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: `has-text-align-${ textAlign }` } : useBlockProps.save( {
|
||||
className: `has-text-align-${ textAlign }`
|
||||
} );
|
||||
return isDynamic ? null : <div { ...blockProps }><InnerBlocks.Content /></div>
|
||||
};
|
|
@ -18,6 +18,16 @@ function tainacan_blocks_render_metadata_sections( $block_attributes, $content,
|
|||
// Builds args from backend query
|
||||
$args = [];
|
||||
|
||||
// Classes from block and Text alignment
|
||||
$text_align = isset($block_attributes['textAlign']) ? $block_attributes['textAlign'] : false;
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => 'metadata-section-slug-$slug' . ( $text_align ? (' has-text-align-' . $text_align) : '' ),
|
||||
)
|
||||
);
|
||||
$args['before'] = '<section id="metadata-section-$id ' . $wrapper_attributes . '>';
|
||||
$args['after'] = '</section>';
|
||||
|
||||
// Checks if we are in the edit page or in the published
|
||||
$current_post = get_post();
|
||||
|
||||
|
@ -34,12 +44,21 @@ function tainacan_blocks_render_metadata_sections( $block_attributes, $content,
|
|||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Classes from block and Text alignment
|
||||
$text_align = isset($block_attributes['textAlign']) ? $block_attributes['textAlign'] : false;
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => ( $text_align ? (' has-text-align-' . $text_align) : '' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Gets inner blocks and wraps them with this parent wrapper
|
||||
$inner_blocks = $block->inner_blocks;
|
||||
$inner_blocks_html = '';
|
||||
foreach ( $inner_blocks as $inner_block ) {
|
||||
$inner_blocks_html .= $inner_block->render();
|
||||
}
|
||||
return $inner_blocks_html;
|
||||
return '<div ' . $wrapper_attributes . '>' . $inner_blocks_html . '</div>';
|
||||
}
|
||||
}
|
|
@ -63,6 +63,9 @@
|
|||
"sectionId": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"providesContext": {
|
||||
|
|
|
@ -3,7 +3,7 @@ const { __ } = wp.i18n;
|
|||
const { Button, Spinner, ToggleControl, Placeholder, PanelBody } = wp.components;
|
||||
|
||||
const ServerSideRender = wp.serverSideRender;
|
||||
const { useBlockProps, InnerBlocks, InspectorControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
const { useBlockProps, InnerBlocks, BlockControls, AlignmentControl, InspectorControls } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
import SingleItemModal from '../../js/selection/single-item-modal.js';
|
||||
import getCollectionIdFromPossibleTemplateEdition from '../../js/template/tainacan-blocks-single-item-template-mode.js';
|
||||
|
@ -25,11 +25,16 @@ export default function ({ attributes, setAttributes, className, isSelected }) {
|
|||
itemMetadataTemplate,
|
||||
dataSource,
|
||||
templateMode,
|
||||
isDynamic
|
||||
isDynamic,
|
||||
textAlign
|
||||
} = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps();
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps( {
|
||||
className: {
|
||||
[ `has-text-align-${ textAlign }` ]: textAlign,
|
||||
}
|
||||
} );
|
||||
const currentWPVersion = (typeof tainacan_blocks != 'undefined') ? tainacan_blocks.wp_version : tainacan_plugin.wp_version;
|
||||
|
||||
function setContent() {
|
||||
|
@ -220,6 +225,15 @@ export default function ({ attributes, setAttributes, className, isSelected }) {
|
|||
</PanelBody>
|
||||
</InspectorControls>
|
||||
|
||||
<BlockControls group="block">
|
||||
<AlignmentControl
|
||||
value={ textAlign }
|
||||
onChange={ ( nextAlign ) => {
|
||||
setAttributes( { textAlign: nextAlign } );
|
||||
} }
|
||||
/>
|
||||
</BlockControls>
|
||||
|
||||
{ isSelected ?
|
||||
(
|
||||
<div>
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
const { useBlockProps, InnerBlocks } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
export default function({ className, attributes }) {
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps.save();
|
||||
|
||||
return attributes.isDynamic ? null : <div { ...blockProps }><InnerBlocks.Content /></div>
|
||||
export default function({ attributes }) {
|
||||
const { textAlign, isDynamic } = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: `has-text-align-${ textAlign }` } : useBlockProps.save( {
|
||||
className: `has-text-align-${ textAlign }`
|
||||
} );
|
||||
return isDynamic ? null : <div { ...blockProps }><InnerBlocks.Content /></div>
|
||||
};
|
|
@ -21,6 +21,17 @@ function tainacan_blocks_render_item_metadata( $block_attributes, $content, $blo
|
|||
'metadata__in' => array_map(function($metadatum) { return $metadatum['id']; }, $metadata)
|
||||
];
|
||||
|
||||
// Classes from block and Text alignment
|
||||
$text_align = isset($block_attributes['textAlign']) ? $block_attributes['textAlign'] : false;
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => 'metadata-type-$type' . ( $text_align ? (' has-text-align-' . $text_align) : '' )
|
||||
)
|
||||
);
|
||||
$args['before'] = '<div ' . $wrapper_attributes . '>';
|
||||
$args['after'] = '</div>';
|
||||
|
||||
if ( $template_mode && $collection_id ) {
|
||||
// Checks if we are in the edit page or in the published
|
||||
$current_post = get_post();
|
||||
|
@ -37,11 +48,20 @@ function tainacan_blocks_render_item_metadata( $block_attributes, $content, $blo
|
|||
|
||||
} else {
|
||||
|
||||
// Classes from block and Text alignment
|
||||
$text_align = isset($block_attributes['textAlign']) ? $block_attributes['textAlign'] : false;
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => ( $text_align ? (' has-text-align-' . $text_align) : '' )
|
||||
)
|
||||
);
|
||||
|
||||
// Gets inner blocks and wraps them with this parent wrapper
|
||||
$inner_blocks = $block->inner_blocks;
|
||||
$inner_blocks_html = '';
|
||||
foreach ( $inner_blocks as $inner_block ) {
|
||||
$inner_blocks_html .= $inner_block->render();
|
||||
}
|
||||
return $inner_blocks_html;
|
||||
return '<div ' . $wrapper_attributes . '>' . $inner_blocks_html . '</div>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"usesContext": [
|
||||
"tainacan/itemId"
|
||||
|
|
|
@ -29,16 +29,14 @@ export default function ({ attributes, setAttributes, className, isSelected }) {
|
|||
dataSource,
|
||||
templateMode,
|
||||
labelLevel,
|
||||
textAlign,
|
||||
style
|
||||
textAlign
|
||||
} = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps( {
|
||||
className: {
|
||||
[ `has-text-align-${ textAlign }` ]: textAlign,
|
||||
},
|
||||
style,
|
||||
}
|
||||
} );
|
||||
const currentWPVersion = (typeof tainacan_blocks != 'undefined') ? tainacan_blocks.wp_version : tainacan_plugin.wp_version;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ function tainacan_blocks_render_item_metadatum( $block_attributes, $content, $bl
|
|||
if ( !$metadatum_id )
|
||||
return '';
|
||||
|
||||
// Builds args from backend query
|
||||
$args = array(
|
||||
'metadata' => $metadatum_id,
|
||||
'before_title' => '<h3 class="wp-block-tainacan-item-metadatum__metadatum-label">',
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"usesContext": [
|
||||
"tainacan/metadataSectionId",
|
||||
|
|
|
@ -8,16 +8,14 @@ export default function ({ attributes, setAttributes, className, context }) {
|
|||
content,
|
||||
sectionId,
|
||||
sectionDescription,
|
||||
textAlign,
|
||||
style
|
||||
textAlign
|
||||
} = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps( {
|
||||
className: {
|
||||
[ `has-text-align-${ textAlign }` ]: textAlign,
|
||||
},
|
||||
style,
|
||||
}
|
||||
} );
|
||||
|
||||
if (context['tainacan/metadataSectionId'])
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
const { SVG, Path } = wp.components;
|
||||
const { SVG, Path, G } = wp.components;
|
||||
|
||||
export default (
|
||||
<SVG
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
viewBox="0 0 6 6"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<Path
|
||||
d="m 6,3.9960001 h 5.016 c 0.544,0 1.008,0.192 1.392,0.576 L 19.416,11.58 c 0.384,0.384 0.576,0.856 0.576,1.416 0,0.56 -0.192,1.032 -0.576,1.416 l -4.992,4.992 c -0.176,0.176 -0.392,0.32 -0.648,0.432 -0.24,0.112 -0.496,0.168 -0.768,0.168 -0.272,0 -0.536,-0.056 -0.792,-0.168 -0.24,-0.112 -0.448,-0.256 -0.624,-0.432 L 4.608,12.42 c -0.4,-0.4 -0.6,-0.872 -0.6,-1.416 V 5.988 C 4.008,5.428 4.2,4.956 4.584,4.572 4.968,4.188 5.44,3.996 6,3.9960001 Z m 1.512,4.992 c 0.416,0 0.768,-0.144 1.056,-0.432 C 8.856,8.2680001 9,7.916 9,7.5 9,7.084 8.856,6.732 8.568,6.444 8.28,6.14 7.928,5.988 7.512,5.988 7.096,5.988 6.736,6.14 6.432,6.444 6.144,6.732 6,7.084 6,7.5 c 0,0.416 0.144,0.7680001 0.432,1.0560001 0.304,0.288 0.664,0.432 1.08,0.432 z"
|
||||
/>
|
||||
<Path d="m0.9834 3.7637v0.37842h1.8848v-0.37842h-1.8848zm2.1602 0v0.37842h1.8755v-0.37842h-1.8755z"/>
|
||||
<Path d="m0.9834 4.7729v0.37793h1.0845v-0.37793h-1.0845zm1.3599 0v0.37793h0.91016v-0.37793h-0.91016z"/>
|
||||
<G stroke-width=".25">
|
||||
<Path d="m2.3397 2.6393q0-0.13997-0.094401-0.22624-0.092773-0.086263-0.43131-0.19043-0.33691-0.10579-0.5485-0.26855-0.20996-0.16439-0.20996-0.44922 0-0.28646 0.23112-0.47038 0.23275-0.18555 0.60872-0.18555 0.40202 0 0.62825 0.21484 0.22624 0.21322 0.22624 0.50944h-0.41016q0-0.17415-0.10905-0.28483-0.10905-0.1123-0.34017-0.1123-0.21647 0-0.32064 0.094401-0.10254 0.092773-0.10254 0.23275 0 0.13346 0.1237 0.22135 0.1237 0.086263 0.37272 0.1595 0.40202 0.11719 0.59407 0.29297 0.19368 0.17578 0.19368 0.45898 0 0.29948-0.22949 0.47363-0.22786 0.17415-0.61361 0.17415-0.22786 0-0.44108-0.083008-0.21159-0.083008-0.34993-0.24902-0.13672-0.16602-0.13672-0.41667h0.41178q0 0.22461 0.14811 0.32389 0.14974 0.099284 0.36784 0.099284 0.21484 0 0.32227-0.087891 0.10905-0.08789 0.10905-0.23112z"/>
|
||||
</G>
|
||||
</SVG>
|
||||
);
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
const { useBlockProps } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
export default function({ attributes }) {
|
||||
const { textAlign, style, sectionId, sectionDescription } = attributes;
|
||||
const { textAlign, sectionId, sectionDescription } = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: `has-text-align-${ textAlign }`, style } : useBlockProps.save( {
|
||||
className: `has-text-align-${ textAlign }`,
|
||||
style,
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: `has-text-align-${ textAlign }` } : useBlockProps.save( {
|
||||
className: `has-text-align-${ textAlign }`
|
||||
} );
|
||||
return (
|
||||
<p { ...blockProps } id={ 'tainacan-metadata-section-description-block-id--' + sectionId }>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"usesContext": [
|
||||
"tainacan/metadataSectionId",
|
||||
|
|
|
@ -19,16 +19,14 @@ export default function ({ attributes, setAttributes, className, context }) {
|
|||
sectionId,
|
||||
sectionName,
|
||||
labelLevel,
|
||||
textAlign,
|
||||
style
|
||||
textAlign
|
||||
} = attributes;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps( {
|
||||
className: {
|
||||
[ `has-text-align-${ textAlign }` ]: textAlign,
|
||||
},
|
||||
style,
|
||||
}
|
||||
} );
|
||||
|
||||
if (context['tainacan/metadataSectionId'])
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
const { SVG, Path } = wp.components;
|
||||
const { SVG, Path, G } = wp.components;
|
||||
|
||||
export default (
|
||||
<SVG
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
viewBox="0 0 6 6"
|
||||
height="24px"
|
||||
width="24px">
|
||||
<Path
|
||||
d="m 6,3.9960001 h 5.016 c 0.544,0 1.008,0.192 1.392,0.576 L 19.416,11.58 c 0.384,0.384 0.576,0.856 0.576,1.416 0,0.56 -0.192,1.032 -0.576,1.416 l -4.992,4.992 c -0.176,0.176 -0.392,0.32 -0.648,0.432 -0.24,0.112 -0.496,0.168 -0.768,0.168 -0.272,0 -0.536,-0.056 -0.792,-0.168 -0.24,-0.112 -0.448,-0.256 -0.624,-0.432 L 4.608,12.42 c -0.4,-0.4 -0.6,-0.872 -0.6,-1.416 V 5.988 C 4.008,5.428 4.2,4.956 4.584,4.572 4.968,4.188 5.44,3.996 6,3.9960001 Z m 1.512,4.992 c 0.416,0 0.768,-0.144 1.056,-0.432 C 8.856,8.2680001 9,7.916 9,7.5 9,7.084 8.856,6.732 8.568,6.444 8.28,6.14 7.928,5.988 7.512,5.988 7.096,5.988 6.736,6.14 6.432,6.444 6.144,6.732 6,7.084 6,7.5 c 0,0.416 0.144,0.7680001 0.432,1.0560001 0.304,0.288 0.664,0.432 1.08,0.432 z"
|
||||
/>
|
||||
<Path d="m0.98355 3.7638v0.37834h4.0357v-0.37834z" stroke-width=".25223"/>
|
||||
<Path d="m0.98355 5.1511h2.2701v-0.37836h-2.2701z" stroke-width=".25223"/>
|
||||
<G stroke-width=".25">
|
||||
<Path d="m2.3397 2.6393q0-0.13997-0.094401-0.22624-0.092773-0.086263-0.43131-0.19043-0.33691-0.10579-0.5485-0.26855-0.20996-0.16439-0.20996-0.44922 0-0.28646 0.23112-0.47038 0.23275-0.18555 0.60872-0.18555 0.40202 0 0.62825 0.21484 0.22624 0.21322 0.22624 0.50944h-0.41016q0-0.17415-0.10905-0.28483-0.10905-0.1123-0.34017-0.1123-0.21647 0-0.32064 0.094401-0.10254 0.092773-0.10254 0.23275 0 0.13346 0.1237 0.22135 0.1237 0.086263 0.37272 0.1595 0.40202 0.11719 0.59407 0.29297 0.19368 0.17578 0.19368 0.45898 0 0.29948-0.22949 0.47363-0.22786 0.17415-0.61361 0.17415-0.22786 0-0.44108-0.083008-0.21159-0.083008-0.34993-0.24902-0.13672-0.16602-0.13672-0.41667h0.41178q0 0.22461 0.14811 0.32389 0.14974 0.099284 0.36784 0.099284 0.21484 0 0.32227-0.087891 0.10905-0.08789 0.10905-0.23112z"/>
|
||||
</G>
|
||||
</SVG>
|
||||
);
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
const { useBlockProps } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
||||
|
||||
export default function({ attributes }) {
|
||||
const { textAlign, style, sectionId, sectionName, labelLevel } = attributes;
|
||||
const { textAlign, sectionId, sectionName, labelLevel } = attributes;
|
||||
const TagName = 'h' + labelLevel;
|
||||
|
||||
// Gets blocks props from hook
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: `has-text-align-${ textAlign }`, style } : useBlockProps.save( {
|
||||
className: `has-text-align-${ textAlign }`,
|
||||
style,
|
||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: `has-text-align-${ textAlign }` } : useBlockProps.save( {
|
||||
className: `has-text-align-${ textAlign }`
|
||||
|
||||
} );
|
||||
return (
|
||||
<TagName { ...blockProps } id={ 'tainacan-metadata-section-name-block-id--' + sectionId }>
|
||||
|
|
Loading…
Reference in New Issue