Changes to theme.json and gallery
This commit is contained in:
@ -1,2 +0,0 @@
|
|||||||
.admin-bar .lg-outer {top:32px;height:calc(100% - 32px)!important}
|
|
||||||
|
|
||||||
BIN
includes/blocks/lcp-gallery/assets/fonts/lg.woff2
Normal file
BIN
includes/blocks/lcp-gallery/assets/fonts/lg.woff2
Normal file
Binary file not shown.
@ -156,9 +156,7 @@ function get_gallery_items_data($media_ids) {
|
|||||||
$alt_text = get_post_meta($media_id, '_wp_attachment_image_alt', true);
|
$alt_text = get_post_meta($media_id, '_wp_attachment_image_alt', true);
|
||||||
|
|
||||||
// Use a fallback for alt text if it's empty
|
// Use a fallback for alt text if it's empty
|
||||||
if (empty($alt_text)) {
|
|
||||||
$alt_text = 'No alt text available';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the gallery item to the array
|
// Add the gallery item to the array
|
||||||
$gallery_items[] = array(
|
$gallery_items[] = array(
|
||||||
@ -444,7 +442,6 @@ add_action( 'init', 'lcp_gallery_block_init' );
|
|||||||
/* Enqueue scripts and styles */
|
/* Enqueue scripts and styles */
|
||||||
function enqueue_lightgallery_scripts() {
|
function enqueue_lightgallery_scripts() {
|
||||||
// Enqueue styles
|
// Enqueue styles
|
||||||
wp_enqueue_style('lcp-gallery', get_template_directory_uri() . '/includes/blocks/lcp-gallery/assets/css/lcp-gallery.css');
|
|
||||||
wp_enqueue_style('lightgallery-css', get_template_directory_uri() . '/includes/blocks/lcp-gallery/assets/css/lightgallery-bundle.min.css');
|
wp_enqueue_style('lightgallery-css', get_template_directory_uri() . '/includes/blocks/lcp-gallery/assets/css/lightgallery-bundle.min.css');
|
||||||
wp_enqueue_style('lg-transitions-css', get_template_directory_uri() . '/includes/blocks/lcp-gallery/assets/css/lg-transitions.css');
|
wp_enqueue_style('lg-transitions-css', get_template_directory_uri() . '/includes/blocks/lcp-gallery/assets/css/lg-transitions.css');
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,21 @@
|
|||||||
"fullScreen": false,
|
"fullScreen": false,
|
||||||
"autoplay": false,
|
"autoplay": false,
|
||||||
"download": false,
|
"download": false,
|
||||||
|
"loop": true,
|
||||||
|
"closeOnTap": true,
|
||||||
|
"enableDrag": true,
|
||||||
|
"enableSwipe": true,
|
||||||
|
"escKey": true,
|
||||||
|
"getCaptionFromTitleOrAlt ": true,
|
||||||
|
"hideBarsDelay": 0,
|
||||||
|
"hideControlOnEnd": false,
|
||||||
|
"hideScrollbar ": false,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"controls": true,
|
||||||
|
"counter": true,
|
||||||
"container": "",
|
"container": "",
|
||||||
"closable": true,
|
"closable": true,
|
||||||
"zoomFromOrigin": false,
|
"zoomFromOrigin": false,
|
||||||
@ -326,6 +341,10 @@
|
|||||||
"numberOfSlideItemsInDom": {
|
"numberOfSlideItemsInDom": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": 10
|
"default": 10
|
||||||
|
},
|
||||||
|
"galleryCustomStyles": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@ -11,7 +11,9 @@ import {
|
|||||||
__experimentalNumberControl as NumberControl,
|
__experimentalNumberControl as NumberControl,
|
||||||
__experimentalUnitControl as UnitControl,
|
__experimentalUnitControl as UnitControl,
|
||||||
TabPanel,
|
TabPanel,
|
||||||
__experimentalBorderControl as BorderControl
|
__experimentalBorderControl as BorderControl,
|
||||||
|
TextareaControl,
|
||||||
|
Popover
|
||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
import metadata from './block.json';
|
import metadata from './block.json';
|
||||||
import './editor.scss';
|
import './editor.scss';
|
||||||
@ -33,6 +35,7 @@ const aspectRatioOptions = [
|
|||||||
{ value: '4-5', label: __('4:5', metadata.textdomain) },
|
{ value: '4-5', label: __('4:5', metadata.textdomain) },
|
||||||
{ value: '2-3', label: __('2:3', metadata.textdomain) }
|
{ value: '2-3', label: __('2:3', metadata.textdomain) }
|
||||||
];
|
];
|
||||||
|
|
||||||
// Check if JetEngine or ACF/SCF are activated and get their gallery field data
|
// Check if JetEngine or ACF/SCF are activated and get their gallery field data
|
||||||
const { apiFetch } = wp;
|
const { apiFetch } = wp;
|
||||||
|
|
||||||
@ -116,7 +119,7 @@ export default function Edit(props) {
|
|||||||
thumbnailActiveStyle,
|
thumbnailActiveStyle,
|
||||||
showCaptions,
|
showCaptions,
|
||||||
zoomFromOrigin,
|
zoomFromOrigin,
|
||||||
|
galleryCustomStyles,
|
||||||
lgSettings
|
lgSettings
|
||||||
} = attributes;
|
} = attributes;
|
||||||
|
|
||||||
@ -358,41 +361,26 @@ const { isTemplate, postType, postId } = useSelect((select) => {
|
|||||||
</PanelBody>
|
</PanelBody>
|
||||||
{/* Display Settings */}
|
{/* Display Settings */}
|
||||||
<PanelBody title={__('Display Settings')}>
|
<PanelBody title={__('Display Settings')}>
|
||||||
<SelectControl
|
<SelectControl
|
||||||
label={__('Initial Layout', metadata.textdomain)}
|
label={__('Initial Layout', metadata.textdomain)}
|
||||||
value={initialLayout}
|
value={initialLayout}
|
||||||
onChange={(newValue) => {
|
onChange={(newValue) => {
|
||||||
// Update the initialLayout attribute
|
// Update the initialLayout attribute
|
||||||
setAttributes({
|
setAttributes({
|
||||||
initialLayout: newValue,
|
initialLayout: newValue,
|
||||||
lgSettings: {
|
lgSettings: {
|
||||||
...attributes.lgSettings, // Preserve existing lgSettings
|
...attributes.lgSettings, // Preserve existing lgSettings
|
||||||
closable: false , // Inline gallery should not be closeable
|
closable: newValue !== 'inline', // Set closable based on the layout choice
|
||||||
|
showMaximizeIcon: newValue === 'inline', // Show maximize icon only if 'inline' is selected
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
options={[
|
options={[
|
||||||
{ value: 'inline', label: __('Inline', metadata.textdomain) },
|
{ value: 'inline', label: __('Inline', metadata.textdomain) },
|
||||||
{ value: 'grid', label: __('Grid', metadata.textdomain) },
|
{ value: 'grid', label: __('Grid', metadata.textdomain) },
|
||||||
// { value: 'justified', label: __('Justified', metadata.textdomain) }, Add later version
|
|
||||||
{ value: 'button', label: __('Button', metadata.textdomain) }
|
{ value: 'button', label: __('Button', metadata.textdomain) }
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
{/* Include option to show maximize icon if inline gallery */}
|
|
||||||
{attributes.initialLayout === 'inline' && (
|
|
||||||
<ToggleControl
|
|
||||||
label={__('Show maximize icon', metadata.textdomain)}
|
|
||||||
checked={attributes.lgSettings.showMaximizeIcon}
|
|
||||||
onChange={(isChecked) => setAttributes({
|
|
||||||
lgSettings: {
|
|
||||||
...attributes.lgSettings, // Preserve existing lgSettings
|
|
||||||
showMaximizeIcon: true, // Set the showMaximizeIcon based on the toggle
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
|
||||||
<ToggleControl
|
<ToggleControl
|
||||||
onChange={(isChecked) => setAttributes({ includePostThumbnail: isChecked })}
|
onChange={(isChecked) => setAttributes({ includePostThumbnail: isChecked })}
|
||||||
@ -469,7 +457,7 @@ const { isTemplate, postType, postId } = useSelect((select) => {
|
|||||||
{initialLayout !== 'inline' && (
|
{initialLayout !== 'inline' && (
|
||||||
<NumberControl
|
<NumberControl
|
||||||
label={__('Max Initial Images')}
|
label={__('Max Initial Images')}
|
||||||
onChange={(newValue) => setAttributes({ maxInitialItems: newValue })}
|
onChange={(newValue) => setAttributes({ maxInitialItems: 1})}
|
||||||
value={maxInitialItems}
|
value={maxInitialItems}
|
||||||
isShiftStepEnabled
|
isShiftStepEnabled
|
||||||
shiftStep={1}
|
shiftStep={1}
|
||||||
@ -479,6 +467,20 @@ const { isTemplate, postType, postId } = useSelect((select) => {
|
|||||||
</PanelBody>
|
</PanelBody>
|
||||||
{/* Gallery Settings */}
|
{/* Gallery Settings */}
|
||||||
<PanelBody title={__('Gallery Settings')}>
|
<PanelBody title={__('Gallery Settings')}>
|
||||||
|
{/* Include option to show maximize icon if inline gallery */}
|
||||||
|
{attributes.initialLayout === 'inline' && (
|
||||||
|
<ToggleControl
|
||||||
|
label={__('Show maximize icon', metadata.textdomain)}
|
||||||
|
checked={attributes.lgSettings.showMaximizeIcon}
|
||||||
|
onChange={(isChecked) => setAttributes({
|
||||||
|
lgSettings: {
|
||||||
|
...attributes.lgSettings, // Preserve existing lgSettings
|
||||||
|
showMaximizeIcon: true, // Set the showMaximizeIcon based on the toggle
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Dynamic Settings */}
|
{/* Dynamic Settings */}
|
||||||
<ToggleControl
|
<ToggleControl
|
||||||
label={__('Dynamic Load', 'lcp')}
|
label={__('Dynamic Load', 'lcp')}
|
||||||
@ -801,10 +803,15 @@ const { isTemplate, postType, postId } = useSelect((select) => {
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
||||||
</PanelBody>
|
</PanelBody>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</InspectorControls>
|
</InspectorControls>
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.admin-bar .lg-container:not(.lg-inline) .lg-outer {top:32px;height:calc(100% - 32px)!important}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -56,8 +56,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"contentSize": "645px",
|
"contentSize": "1140px",
|
||||||
"wideSize": "1340px"
|
"wideSize": "1440px"
|
||||||
},
|
},
|
||||||
"spacing": {
|
"spacing": {
|
||||||
"defaultSpacingSizes": false,
|
"defaultSpacingSizes": false,
|
||||||
|
|||||||
Reference in New Issue
Block a user