Skip to content

Commit 99e82e8

Browse files
committed
Refactor editor-bindings plugin to rename and update binding source from 'wpviplearn' to 'block-dev-ex'. This includes changes to package.json, plugin metadata, and all relevant code files to ensure consistent naming and functionality across the plugin. Updated README files to reflect the new binding source.
1 parent 5106ad6 commit 99e82e8

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

plugins/editor-bindings/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This example is taken from the following WordPress Developer Blog post:
1919

2020
Some key ideas for this example:
2121

22-
- **Custom Binding Source Registration**: The plugin registers a `wpviplearn/post-data` binding source both server-side (`register_block_bindings_source()`) and client-side (`registerBlockBindingsSource()`)
22+
- **Custom Binding Source Registration**: The plugin registers a `block-dev-ex/post-data` binding source both server-side (`register_block_bindings_source()`) and client-side (`registerBlockBindingsSource()`)
2323
- **Dynamic Data Access**: The binding source provides access to post title, excerpt, and permalink through the Block Bindings API
2424
- **Editor Integration**: Uses WordPress Data API (`@wordpress/blocks` and editor store) to fetch and update post data in real-time
2525
- **Controlled Editability**: Implements `canUserEditValue()` to make title and excerpt editable while keeping permalink read-only

plugins/editor-bindings/_playground/export.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@
5454
<guid isPermaLink="false">http://localhost:8881/?p=1</guid>
5555
<description></description>
5656
<content:encoded><![CDATA[<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40","left":"var:preset|spacing|40","right":"var:preset|spacing|40"}}},"backgroundColor":"accent-1","layout":{"type":"constrained"}} -->
57-
<div class="wp-block-group has-accent-1-background-color has-background" style="padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)"><!-- wp:heading {"placeholder":"Add post title","metadata":{"bindings":{"content":{"source":"wpviplearn/post-data","args":{"key":"title"}}}}} -->
57+
<div class="wp-block-group has-accent-1-background-color has-background" style="padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)"><!-- wp:heading {"placeholder":"Add post title","metadata":{"bindings":{"content":{"source":"block-dev-ex/post-data","args":{"key":"title"}}}}} -->
5858
<h2 class="wp-block-heading"></h2>
5959
<!-- /wp:heading -->
6060
61-
<!-- wp:paragraph {"placeholder":"Add post excerpt","metadata":{"bindings":{"content":{"source":"wpviplearn/post-data","args":{"key":"excerpt"}}}}} -->
61+
<!-- wp:paragraph {"placeholder":"Add post excerpt","metadata":{"bindings":{"content":{"source":"block-dev-ex/post-data","args":{"key":"excerpt"}}}}} -->
6262
<p></p>
6363
<!-- /wp:paragraph -->
6464
6565
<!-- wp:buttons -->
66-
<div class="wp-block-buttons"><!-- wp:button {"metadata":{"bindings":{"url":{"source":"wpviplearn/post-data","args":{"key":"permalink"}}}}} -->
66+
<div class="wp-block-buttons"><!-- wp:button {"metadata":{"bindings":{"url":{"source":"block-dev-ex/post-data","args":{"key":"permalink"}}}}} -->
6767
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">Read post →</a></div>
6868
<!-- /wp:button --></div>
6969
<!-- /wp:buttons --></div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('wp-blocks'), 'version' => '42ae888a666ec4f1550a');
1+
<?php return array('dependencies' => array('wp-blocks'), 'version' => 'da898a8b1892371a9554');

plugins/editor-bindings/build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/editor-bindings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "wpviplearn-editor-bindings",
2+
"name": "block-dev-ex-editor-bindings",
33
"scripts": {
44
"start": "wp-scripts start",
55
"build": "wp-scripts build"

plugins/editor-bindings/plugin.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Requires PHP: 7.4
99
* Author: Your Name
1010
* Author URI: https://developer.wordpres.org/news
11-
* Text Domain: wpviplearn
11+
* Text Domain: block-dev-ex
1212
*
1313
* @package CreateBlock
1414
*/
@@ -20,9 +20,9 @@
2020
*/
2121
function bde_register_binding_sources() {
2222
register_block_bindings_source(
23-
'wpviplearn/post-data',
23+
'block-dev-ex/post-data',
2424
array(
25-
'label' => __( 'Post Data', 'wpviplearn' ),
25+
'label' => __( 'Post Data', 'block-dev-ex' ),
2626
'get_value_callback' => 'bde_post_data_callback',
2727
'uses_context' => array( 'postId' ),
2828
)
@@ -66,13 +66,13 @@ function bde_editor_assets() {
6666
$asset = include "{$dir}/build/index.asset.php";
6767

6868
wp_enqueue_script(
69-
'wpviplearn-editor-bindings',
69+
'block-dev-ex-editor-bindings',
7070
"{$url}/build/index.js",
7171
$asset['dependencies'],
7272
$asset['version'],
7373
true
7474
);
7575

76-
wp_set_script_translations( 'wpviplearn-editor-bindings', 'wpviplearn' );
76+
wp_set_script_translations( 'block-dev-ex-editor-bindings', 'block-dev-ex' );
7777
}
7878
}

plugins/editor-bindings/src/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ const editableAttributes = [ 'title', 'excerpt' ];
2828

2929
```js
3030
registerBlockBindingsSource({
31-
name: 'wpviplearn/post-data',
31+
name: 'block-dev-ex/post-data',
3232
usesContext: [ 'postType' ],
3333
...
3434
});
3535
```
3636

37-
- Registers a new source called `wpviplearn/post-data`.
37+
- Registers a new source called `block-dev-ex/post-data`.
3838
- It declares that it uses the `postType` context (e.g., 'post', 'page').
3939
- Learn more about [block bindings sources](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-bindings/).
4040

plugins/editor-bindings/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const readOnlyAttributes = [ 'permalink' ];
55
const editableAttributes = [ 'title', 'excerpt' ];
66

77
registerBlockBindingsSource( {
8-
name: 'wpviplearn/post-data',
8+
name: 'block-dev-ex/post-data',
99
usesContext: [ 'postType' ],
1010
getValues( { select, bindings } ) {
1111
const values = {};

0 commit comments

Comments
 (0)