Skip to content

Commit

Permalink
Create sb-debug-block from sb-starting-block template, and refactor S…
Browse files Browse the repository at this point in the history
…tarting to Debug. Issue #1
  • Loading branch information
bobbingwide committed May 16, 2021
1 parent 7a3b268 commit d59392f
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 47 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Starting block
# Debug block
* Contributors: bobbingwide
* Tags: block, starting, scaffold, SSR
* Tags: block, debug, scaffold, SSR
* Tested up to: 5.7.0
* Stable tag: 0.0.0
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-2.0.html

Starting point for a single block server side rendered block.
Debug point for a single block server side rendered block.

## Description
The Starting block plugin is a single block plugin to be used as the starting point for future Server Side Rendered blocks.
## Description
The Debug block plugin is a single block plugin to be used as the debug point for future Server Side Rendered blocks.

## Installation
## Installation
The purpose of this plugin is to provide the source code for a Server Side Rendered block
that is copied into an existing plugin where the new SSR logic replaces an existing shortcode.

You should not need to activate this plugin. If you do, it's just like any other plugin.

## Screenshots
1. Starting block - rendered
2. Starting block - settings
## Screenshots
1. Debug block - rendered
2. Debug block - settings

## Upgrade Notice
# 0.0.0
## Upgrade Notice
# 0.0.0
First version to be used to replace any `[your name here]` shortcodes in FSE themes

## Changelog
# 0.0.0
* Added: First version of the server side rendered block,[#1](https://github.com/bobbingwide/sb-starting-block/issues/1)
## Changelog
# 0.0.0
* Added: First version of the server side rendered block,[#1](https://github.com/bobbingwide/sb-debug-block/issues/1)
* Tested: With WordPress 5.7.1 and WordPress Multi Site
* Tested: With Gutenberg 10.6.0-rc.1
* Tested: With PHP 8.0
10 changes: 5 additions & 5 deletions block.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"apiVersion": 2,
"name": "oik-sb/sb-starting-block",
"title": "Starting block",
"name": "oik-sb/sb-debug-block",
"title": "Debug block",
"category": "widgets",
"icon": "megaphone",
"description": "Starting Server Side Rendered block",
"icon": "code-standards",
"description": "Debug Server Side Rendered block",
"supports": {
"html": false
},
"textdomain": "sb-starting-block",
"textdomain": "sb-debug-block",
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css",
"style": "file:./build/style-index.css"
Expand Down
2 changes: 1 addition & 1 deletion build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sb-starting-block",
"name": "sb-debug-block",
"version": "0.0.0",
"description": "Starting Server Side Rendered Block",
"description": "Debug Server Side Rendered Block",
"author": "bobbingwide",
"license": "GPLv3",
"main": "build/index.js",
Expand All @@ -13,9 +13,9 @@
"start": "wp-scripts start",
"packages-update": "wp-scripts packages-update",
"dev": "wp-scripts start",
"makepot": "wp i18n make-pot . languages/sb-starting-block.pot --exclude=node_modules,vendor,src",
"makepot": "wp i18n make-pot . languages/sb-debug-block.pot --exclude=node_modules,vendor,src",
"makejson": "wp i18n make-json languages --no-purge",
"l10n": "l10n sb-starting-block"
"l10n": "l10n sb-debug-block"
},
"dependencies": {
"@wordpress/block-editor": "^5.3.3",
Expand Down
16 changes: 8 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
=== Starting block ===
=== Debug block ===
Contributors: bobbingwide
Tags: block, starting, scaffold, SSR
Tags: block, debug, scaffold, SSR
Tested up to: 5.7.0
Stable tag: 0.0.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Starting point for a single block server side rendered block.
Debug point for a single block server side rendered block.

== Description ==
The Starting block plugin is a single block plugin to be used as the starting point for future Server Side Rendered blocks.
The Debug block plugin is a single block plugin to be used as the debug point for future Server Side Rendered blocks.

== Installation ==
The purpose of this plugin is to provide the source code for a Server Side Rendered block
Expand All @@ -18,16 +18,16 @@ that is copied into an existing plugin where the new SSR logic replaces an exist
You should not need to activate this plugin. If you do, it's just like any other plugin.

== Screenshots ==
1. Starting block - rendered
2. Starting block - settings
1. Debug block - rendered
2. Debug block - settings

== Upgrade Notice ==
= 0.0.0 =
First version to be used to replace any `[your name here]` shortcodes in FSE themes

== Changelog ==
= 0.0.0 =
* Added: First version of the server side rendered block,[#1](https://github.com/bobbingwide/sb-starting-block/issues/1)
* Added: First version of the server side rendered block,[#1](https://github.com/bobbingwide/sb-debug-block/issues/1)
* Tested: With WordPress 5.7.1 and WordPress Multi Site
* Tested: With Gutenberg 10.6.0-rc.1
* Tested: With PHP 8.0
* Tested: With PHP 8.0
20 changes: 10 additions & 10 deletions sb-starting-block.php → sb-debug-block.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: Starting block
* Description: Starting point for a single block server side rendered block
* Plugin Name: Debug block
* Description: Debug point for a single block server side rendered block
* Requires at least: 5.7
* Requires PHP: 7.3
* Version: 0.0.0
Expand All @@ -20,13 +20,13 @@
*
* @see https://developer.wordpress.org/block-editor/tutorials/block-tutorial/writing-your-first-block-type/
*/
function oik_sb_sb_starting_block_block_init() {
$args = [ 'render_callback' => 'oik_sb_sb_starting_block_dynamic_block'];
function oik_sb_sb_debug_block_block_init() {
$args = [ 'render_callback' => 'oik_sb_sb_debug_block_dynamic_block'];
register_block_type_from_metadata( __DIR__, $args );
}

function oik_sb_sb_starting_block_loaded() {
add_action( 'init', 'oik_sb_sb_starting_block_block_init' );
function oik_sb_sb_debug_block_loaded() {
add_action( 'init', 'oik_sb_sb_debug_block_block_init' );
}
/**
* Implements post-edit block.
Expand All @@ -39,16 +39,16 @@ function oik_sb_sb_starting_block_loaded() {
*
* @return string
*/
function oik_sb_sb_starting_block_dynamic_block( $attributes ) {
function oik_sb_sb_debug_block_dynamic_block( $attributes ) {
$classes = '';
if ( isset( $attributes['textAlign'] ) ) {
$classes .= 'has-text-align-' . $attributes['textAlign'];
}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
$content = __( 'Starting block.', 'sb-starting-block');
$content = __( 'Debug block.', 'sb-starting-block');
$html = sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $content );
// $html=\oik\oik_blocks\oik_blocks_check_server_func( "shortcodes/starting-block.php", "sb-starting-block", "oik_sb_sb_starting_block" );
// $html=\oik\oik_blocks\oik_blocks_check_server_func( "shortcodes/starting-block.php", "sb-starting-block", "oik_sb_sb_debug_block" );
return $html;
}

oik_sb_sb_starting_block_loaded();
oik_sb_sb_debug_block_loaded();
2 changes: 1 addition & 1 deletion src/starting-block/edit.js → src/debug-block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import './editor.scss';
export default function Edit ( { attributes, className, isSelected, setAttributes } ) {
return (
<ServerSideRender
block="oik-sb/sb-starting-block" attributes={attributes}
block="oik-sb/sb-debug-block" attributes={attributes}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* Replace them with your own styles or remove the file completely.
*/

.wp-block-oik-sb-sb-starting-block {
.wp-block-oik-sb-sb-debug-block {

}
2 changes: 1 addition & 1 deletion src/starting-block/index.js → src/debug-block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import save from './save';
*
* @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
*/
registerBlockType( 'oik-sb/sb-starting-block', {
registerBlockType( 'oik-sb/sb-debug-block', {
/**
* @see ./edit.js
*/
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* Replace them with your own styles or remove the file completely.
*/

.wp-block-oik-sb-sb-starting-block {
.wp-block-oik-sb-sb-debug-block {

}
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import './starting-block';
import './debug-block';

0 comments on commit d59392f

Please sign in to comment.