mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-19 06:33:50 +09:00
- remove old blocks script
This commit is contained in:
@@ -126,110 +126,3 @@ wp.blocks.registerBlockType( 'um-block/um-forms', {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
//-------------------------------------\\
|
||||
//------------ Um Account -------------\\
|
||||
//-------------------------------------\\
|
||||
wp.blocks.registerBlockType( 'um-block/um-account', {
|
||||
title: wp.i18n.__( 'Account', 'ultimate-member' ),
|
||||
description: wp.i18n.__( 'Displaying the account page of the current user', 'ultimate-member' ),
|
||||
icon: 'id',
|
||||
category: 'um-blocks',
|
||||
attributes: {
|
||||
content: {
|
||||
source: 'html',
|
||||
selector: 'p'
|
||||
},
|
||||
tab: {
|
||||
type: 'select'
|
||||
}
|
||||
},
|
||||
|
||||
edit: function( props ) {
|
||||
var content = props.attributes.content,
|
||||
tab = props.attributes.tab;
|
||||
|
||||
function get_options() {
|
||||
var option = [];
|
||||
|
||||
option.push( { label: wp.i18n.__( 'All', 'ultimate-member' ), value: 'all' } );
|
||||
|
||||
for ( var key in um_account_settings ) {
|
||||
if ( um_account_settings.hasOwnProperty( key ) && um_account_settings[ key ]['enabled'] ) {
|
||||
option.push(
|
||||
{
|
||||
label: um_account_settings[ key ]['label'],
|
||||
value: key
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return option;
|
||||
}
|
||||
|
||||
function umShortcode( value ) {
|
||||
|
||||
var shortcode = '[ultimatemember_account';
|
||||
|
||||
if ( value !== 'all' ) {
|
||||
shortcode = shortcode + ' tab="' + value + '"';
|
||||
}
|
||||
|
||||
shortcode = shortcode + ']';
|
||||
|
||||
props.setAttributes({ content: shortcode });
|
||||
}
|
||||
|
||||
if ( content === undefined ) {
|
||||
props.setAttributes({ content: '[ultimatemember_account]' });
|
||||
}
|
||||
|
||||
return [
|
||||
wp.element.createElement(
|
||||
"div",
|
||||
{
|
||||
className: 'um-account-wrapper'
|
||||
},
|
||||
wp.i18n.__( 'Account', 'ultimate-member' )
|
||||
),
|
||||
wp.element.createElement(
|
||||
wp.blockEditor.InspectorControls,
|
||||
{},
|
||||
wp.element.createElement(
|
||||
wp.components.PanelBody,
|
||||
{
|
||||
title: wp.i18n.__( 'Account Tab', 'ultimate-member' )
|
||||
},
|
||||
wp.element.createElement(
|
||||
wp.components.SelectControl,
|
||||
{
|
||||
label: wp.i18n.__( 'Select Tab', 'ultimate-member' ),
|
||||
className: "um_select_account_tab",
|
||||
type: 'number',
|
||||
value: props.attributes.tab,
|
||||
options: get_options(),
|
||||
onChange: function onChange( value ) {
|
||||
props.setAttributes({ tab: value });
|
||||
umShortcode( value );
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
},
|
||||
|
||||
save: function( props ) {
|
||||
|
||||
return wp.element.createElement(
|
||||
wp.editor.RichText.Content,
|
||||
{
|
||||
tagName: 'p',
|
||||
className: props.className,
|
||||
value: props.attributes.content
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user