-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from codemonkey-jack/gb-blocks-experiment
1.5.92
- Loading branch information
Showing
22 changed files
with
3,767 additions
and
2,411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
( function( wp ) { | ||
var registerBlockType = wp.blocks.registerBlockType; | ||
var ServerSideRender = wp.serverSideRender; | ||
var __ = wp.i18n.__; | ||
var TextControl = wp.components.TextControl; | ||
var InspectorControls = wp.blockEditor.InspectorControls; | ||
var PanelBody = wp.components.PanelBody; | ||
|
||
registerBlockType( 'kbs/login-block', { | ||
title: __( 'KBS Login', 'kb-support' ), | ||
icon: 'admin-users', | ||
category: 'common', | ||
attributes: { | ||
redirect: { | ||
type: 'string', | ||
default: '' | ||
} | ||
}, | ||
|
||
edit: function( props ) { | ||
var attributes = props.attributes; | ||
var setAttributes = props.setAttributes; | ||
|
||
return [ | ||
wp.element.createElement( | ||
InspectorControls, | ||
null, | ||
wp.element.createElement( | ||
PanelBody, | ||
{ title: __( 'Settings', 'kb-support' ) }, | ||
wp.element.createElement( | ||
TextControl, | ||
{ | ||
label: __( 'Redirect URL', 'kb-support' ), | ||
value: attributes.redirect, | ||
onChange: function( value ) { | ||
setAttributes( { redirect: value } ); | ||
} | ||
} | ||
) | ||
) | ||
), | ||
wp.element.createElement( | ||
ServerSideRender, | ||
{ | ||
block: "kbs/login-block", | ||
attributes: attributes | ||
} | ||
) | ||
]; | ||
}, | ||
|
||
save: function() { | ||
return null; | ||
}, | ||
} ); | ||
} )( window.wp ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
( function( wp ) { | ||
var registerBlockType = wp.blocks.registerBlockType; | ||
var ServerSideRender = wp.serverSideRender; | ||
var __ = wp.i18n.__; | ||
|
||
registerBlockType( 'kbs/profile-editor-block', { | ||
title: __( 'KBS Profile Editor', 'kb-support' ), | ||
icon: 'admin-users', // Use a WordPress dashicon or custom SVG | ||
category: 'common', | ||
|
||
edit: function() { | ||
return wp.element.createElement( | ||
ServerSideRender, | ||
{ | ||
block: "kbs/profile-editor-block" | ||
} | ||
); | ||
}, | ||
|
||
save: function() { | ||
// Rendering in PHP, so return null | ||
return null; | ||
}, | ||
} ); | ||
} )( window.wp ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
( function( wp ) { | ||
var registerBlockType = wp.blocks.registerBlockType; | ||
var ServerSideRender = wp.serverSideRender; | ||
var __ = wp.i18n.__; | ||
var TextControl = wp.components.TextControl; | ||
var InspectorControls = wp.blockEditor.InspectorControls; | ||
var PanelBody = wp.components.PanelBody; | ||
|
||
registerBlockType( 'kbs/register-block', { | ||
title: __( 'KBS Register', 'kb-support' ), | ||
icon: 'admin-users', | ||
category: 'common', | ||
attributes: { | ||
redirect: { | ||
type: 'string', | ||
default: '' | ||
} | ||
}, | ||
|
||
edit: function( props ) { | ||
var attributes = props.attributes; | ||
var setAttributes = props.setAttributes; | ||
|
||
return [ | ||
wp.element.createElement( | ||
InspectorControls, | ||
null, | ||
wp.element.createElement( | ||
PanelBody, | ||
{ title: __( 'Settings', 'kb-support' ) }, | ||
wp.element.createElement( | ||
TextControl, | ||
{ | ||
label: __( 'Redirect URL', 'kb-support' ), | ||
value: attributes.redirect, | ||
onChange: function( value ) { | ||
setAttributes( { redirect: value } ); | ||
} | ||
} | ||
) | ||
) | ||
), | ||
wp.element.createElement( | ||
ServerSideRender, | ||
{ | ||
block: "kbs/register-block", | ||
attributes: attributes | ||
} | ||
) | ||
]; | ||
}, | ||
|
||
save: function() { | ||
return null; | ||
}, | ||
} ); | ||
} )( window.wp ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
( function( wp ) { | ||
var registerBlockType = wp.blocks.registerBlockType; | ||
var ServerSideRender = wp.serverSideRender; | ||
var __ = wp.i18n.__; | ||
|
||
registerBlockType( 'kbs/search-block', { | ||
title: __( 'KBS Search', 'kb-support' ), | ||
icon: 'search', // Use a WordPress dashicon or custom SVG | ||
category: 'common', | ||
|
||
edit: function() { | ||
return wp.element.createElement( | ||
ServerSideRender, | ||
{ | ||
block: "kbs/search-block" | ||
} | ||
); | ||
}, | ||
|
||
save: function() { | ||
// Rendering in PHP, so return null | ||
return null; | ||
}, | ||
} ); | ||
} )( window.wp ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
( function( wp ) { | ||
var registerBlockType = wp.blocks.registerBlockType; | ||
var ServerSideRender = wp.serverSideRender; | ||
var __ = wp.i18n.__; | ||
var TextControl = wp.components.TextControl; | ||
var InspectorControls = wp.blockEditor.InspectorControls; | ||
var PanelBody = wp.components.PanelBody; | ||
|
||
registerBlockType( 'kbs/submit-block', { | ||
title: __( 'KBS Submit', 'kb-support' ), | ||
icon: 'forms', // Use a WordPress dashicon or custom SVG | ||
category: 'common', | ||
attributes: { | ||
formId: { | ||
type: 'string', | ||
default: '' | ||
} | ||
}, | ||
|
||
edit: function( props ) { | ||
var attributes = props.attributes; | ||
var setAttributes = props.setAttributes; | ||
|
||
return [ | ||
wp.element.createElement( | ||
InspectorControls, | ||
null, | ||
wp.element.createElement( | ||
PanelBody, | ||
{ title: __( 'Settings', 'kb-support' ) }, | ||
wp.element.createElement( | ||
TextControl, | ||
{ | ||
label: __( 'Form ID', 'kb-support' ), | ||
value: attributes.formId, | ||
onChange: function( value ) { | ||
setAttributes( { formId: value } ); | ||
} | ||
} | ||
) | ||
) | ||
), | ||
wp.element.createElement( | ||
ServerSideRender, | ||
{ | ||
block: "kbs/submit-block", | ||
attributes: attributes | ||
} | ||
) | ||
]; | ||
}, | ||
|
||
save: function() { | ||
return null; | ||
}, | ||
} ); | ||
} )( window.wp ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
( function( wp ) { | ||
var registerBlockType = wp.blocks.registerBlockType; | ||
var ServerSideRender = wp.serverSideRender; | ||
var __ = wp.i18n.__; | ||
|
||
registerBlockType( 'kbs/tickets-block', { | ||
title: __( 'KBS Tickets', 'kb-support' ), | ||
icon: 'tickets-alt', // Use a WordPress dashicon or custom SVG | ||
category: 'common', | ||
|
||
edit: function() { | ||
return wp.element.createElement( | ||
ServerSideRender, | ||
{ | ||
block: "kbs/tickets-block" | ||
} | ||
); | ||
}, | ||
|
||
save: function() { | ||
// Rendering in PHP, so return null | ||
return null; | ||
}, | ||
} ); | ||
} )( window.wp ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
// Ensure ABSPATH is defined for security | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
// Function to render the block | ||
function kbs_login_block_render( $attributes ) { | ||
$redirect = isset( $attributes['redirect'] ) ? $attributes['redirect'] : ''; | ||
|
||
// Check if the shortcode function exists | ||
if ( function_exists( 'kbs_login_form_shortcode' ) ) { | ||
return kbs_login_form_shortcode( array( 'redirect' => $redirect ) ); | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
// Register the block | ||
function kbs_register_login_block() { | ||
// Check if function exists | ||
if ( function_exists( 'register_block_type' ) ) { | ||
register_block_type( 'kbs/login-block', array( | ||
'render_callback' => 'kbs_login_block_render', | ||
'attributes' => array( | ||
'redirect' => array( | ||
'type' => 'string', | ||
'default' => '', | ||
), | ||
), | ||
) ); | ||
} | ||
} | ||
add_action( 'init', 'kbs_register_login_block' ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
// Ensure ABSPATH is defined for security | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
// Function to render the block | ||
function kbs_profile_editor_block_render() { | ||
// Check if the shortcode function exists | ||
if ( function_exists( 'kbs_profile_editor_shortcode' ) ) { | ||
// Pass an empty array as the argument | ||
return kbs_profile_editor_shortcode( array() ); | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
// Register the block | ||
function kbs_register_profile_editor_block() { | ||
// Check if function exists | ||
if ( function_exists( 'register_block_type' ) ) { | ||
register_block_type( 'kbs/profile-editor-block', array( | ||
'render_callback' => 'kbs_profile_editor_block_render', | ||
) ); | ||
} | ||
} | ||
add_action( 'init', 'kbs_register_profile_editor_block' ); |
Oops, something went wrong.