{ imgURL && !! imgURL.length && (
) }
setAttributes( { ctaTitle: value } ) }
/>
setAttributes( { ctaText: value } ) }
/>
setAttributes( { buttonText: value } ) }
/>
{ isSelected && (
) }
];
}
}
// Register the block
registerBlockType( 'advanced-blocks/block-cta', {
title: __( 'Call To Action', 'tf' ),
description: __( 'Add a call to action section with a title, text, and a button.', 'tf' ),
icon: 'megaphone',
category: 'advanced-blocks',
keywords: [
__( 'call to action', 'tf' ),
__( 'cta', 'tf' ),
],
attributes: blockAttributes,
getEditWrapperProps( { ctaWidth } ) {
if ( 'left' === ctaWidth || 'right' === ctaWidth || 'full' === ctaWidth ) {
return { 'data-align': ctaWidth };
}
},
// Render the block components
edit: ABCTABlock,
// Save the attributes and markup
save: function( props ) {
// Setup the attributes
const {
buttonText,
buttonUrl,
buttonAlignment,
buttonBackgroundColor,
buttonTextColor,
buttonSize,
buttonShape,
buttonTarget,
ctaTitle,
ctaText,
ctaTitleFontSize,
ctaTextFontSize,
ctaWidth,
ctaBackgroundColor,
ctaTextColor,
imgURL,
imgID,
imgAlt,
dimRatio,
} = props.attributes;
// Save the block markup for the front end
return (