Comments (5)
You mentioned not using this feature. How are you adding custom blocks to Sage that aren't ACF based?
I only use ACF for blocks. I've written a few native blocks in the past – they are great, but once ACF got InnerBlock support, I was sold as I'm much more comfortable with PHP in the end.
When I was using native blocks I used the same approach as Poet though:
add_action('init', function () {
return collect([
'block/product',
])->each(function ($block) {
register_block_type($block, [
'render_callback' => function ($data, $content) use ($block) {
return view(resource_path('views/blocks/' . Str::after($block, '/') . '.blade.php'), [
'data' => (object) $data,
'content' => ! empty(wp_strip_all_tags($content, true)) ? $content : null
]);
}
]);
});
}, 20);
so I'm definitely confused on what could be wrong.
from poet.
Hmm. I don't use this feature so I didn't know anything was wrong with it.
I'm not exactly sure though. I tried using register_block_type()
outside of Poet and still can't seem to get a block to register in the editor.
I'm seeing:
^ WP_Block_Type {#2372 ▼
+api_version: 1
+name: "app/example"
+title: ""
+category: null
+parent: null
+ancestor: null
+icon: null
+description: ""
+keywords: []
+textdomain: null
+styles: []
+variations: []
+supports: null
+example: null
+render_callback: Closure() {#2369}
+attributes: array:1 [▶]
+uses_context: []
+provides_context: null
+editor_script_handles: []
+script_handles: []
+view_script_handles: []
+editor_style_handles: []
+style_handles: []
-deprecated_properties: array:5 [▶]
}
being returned when registering. I figured maybe it needed a title
, category
, etc. set on it, but even when I do that, I'm getting nothing.
I checked wp.blocks.getBlockTypes();
in console and it is not showing up there, either.
I'll have to tinker more but not sure if the usage of this function was updated in core at some point or if I'm going crazy. :)
from poet.
Thanks for taking a look. I thought I was going crazy too. haha
You mentioned not using this feature. How are you adding custom blocks to Sage that aren't ACF based?
from poet.
think I'm having this problem too. Is this feature broken in poet?
from poet.
Have you registered your block in the editor after registering the block with Poet?
import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import { InnerBlocks } from '@wordpress/block-editor';
import { edit } from './edit';
registerBlockType('block/example', {
title: __('Example', 'app'),
description: 'An example block.',
category: 'common',
icon: 'star-filled',
attributes: {
title: {
type: 'string'
},
},
edit,
save: props => <InnerBlocks.Content />
});
from poet.
Related Issues (20)
- Gutenberg Block Category
- I'm drafting something up
- WordPress 5.8 block_categories deprecated HOT 1
- Shouldn't add_filter be add_action? HOT 4
- Renaming default 'post' post_type HOT 3
- The custom block is not working HOT 4
- compatibility with acorn and sage 10 beta 3 HOT 1
- Unable to modify default 'category' taxonomy HOT 1
- $content is empty when the only content is an img HOT 2
- Unable to publish the config/poet.php HOT 1
- Translating post type label and slug HOT 18
- Manually publish HOT 2
- Query vars not working aside post_types archives pages HOT 1
- Register fields with WP GraphQL HOT 4
- Check pattern content before return pattern blade view
- Error including functions in config file HOT 2
- Can not register post type again when move code to server or pull code to another devices HOT 7
- Callback for custom fields in CPT HOT 2
- taxonomies defined by poet aren't available to acf-composer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poet.