nk-crew / lazy-blocks Goto Github PK
View Code? Open in Web Editor NEWUse Lazy Blocks plugin to rapidly build custom blocks without ever leaving your WordPress editor
Home Page: https://www.lazyblocks.com/
License: GNU General Public License v2.0
Use Lazy Blocks plugin to rapidly build custom blocks without ever leaving your WordPress editor
Home Page: https://www.lazyblocks.com/
License: GNU General Public License v2.0
Hi! I am using the latest version in of your plugin, but I have problem with the field type img, here is my setting:
I am placing this code in my functions.php
function getlistatemplate( $atts ) {
var_dump($atts);
return $atts;
}
add_shortcode( 'shortcode_lista_template', 'getlistatemplate' );
This is what is shown in frontend
array(3) { ["classname"]=> string(0) "" ["align"]=> string(0) "" ["anchor"]=> string(0) "" }
Best!
As related here:
https://lazyblocks.com/documentation/blocks-code/handlebars/
Output HTML support Handlebars syntax
but when i try to log via the output with {{log "Log!" level="error"}}
i get this error message:
Fatal error: Uncaught InvalidArgumentException: Variable name is invalid: "log "Log!" level="error"" in ...
We need to validate block slug, because it supports only lowercase alphanumeric characters and dashes.
/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test( name )
https://github.com/WordPress/gutenberg/blob/master/packages/blocks/src/api/registration.js#L79-L84
Love the work you’ve done!
I think there is a bigger use case that is available in ACF (Conditional Logic) that should become available soon enough in Lazy Blocks as well.
It is support for showing and hiding other fields in the back-end, depending on the state of a toggle or such (checkbox, dropdown select).
Here's an example case where it is dearly needed for the user experience of the back-end:
Keep up the good work and this plugin can become huge 🙃 !
Error when adding image in block : undefined is not an object (evaluating 'h.length')
where h = allowedTypes in https://github.com/WordPress/gutenberg/blob/27b15298656576e0d83e9603555f3f62db7ad5ac/packages/editor/src/components/media-placeholder/index.js#L145
It doesn't save the values added in choices
Is it allowed to pass a custom code function to be rendered in the editor just as it is passed to FrontEnd?
Please. If this is possible explain to me how. If it is still not allowed, could you implement this functionality?
That would make Lazy Blocks even better. Thx!
Refered in:
https://wordpress.org/support/topic/php-code-for-render-in-editor/
The "Frontend HTML" must have some content in it, before registering a PHP output function. Otherwise, the output code will not show up at all in the frontend.
Hi,
I had to re-install version 1.3.1 because it appears that posts with an apostrophe in the title were not saved anymore in version 1.4.0...
On creation, when i push the publish button, posts are saved as draft but not published.
On already published posts there is no update possible. However, the quick edit publication still works...
Issue on WP 5.0.3
Thanks for this very usefull plugin anyway :)
Séb.
the action lzb/handlebars/object it seems not working.
i tried to add in my functions.php
theme file the following code:
function my_custom_lazyblock_handlebars_helper ( $handlebars ) {
exit('register'); // it does not anything because i get the error before that
$handlebars->registerHelper( 'my_test_helper', function( $val ) {
return '<p>My test helper: ' . $val . '</p>';
} );
}
add_action( 'lzb/handlebars/object', 'my_custom_lazyblock_handlebars_helper' );`
but i get:
Fatal error: Uncaught RuntimeException: "my_test_helper"" is not registered as a helper in /[...]/wp-content/plugins/lazy-blocks/vendor/Handlebars/Template.php:497
Stack trace:
#0 /[...]/wp-content/plugins/lazy-blocks/vendor/Handlebars/Template.php(240): Handlebars\Template->_section(Object(Handlebars\Context), Array)
#1 /[...]/wp-content/plugins/lazy-blocks/vendor/Handlebars/Template.php(187): Handlebars\Template->renderInternal(Array, Object(Handlebars\Context))
#2 /[...]/wp-content/plugins/lazy-blocks/vendor/Handlebars/Handlebars.php(210): Handlebars\Template->render(Object(Handlebars\Context))
#3 /[...]/wp-content/plugins/lazy-blocks/classes/class-blocks.php(1352): Handlebars\Handlebars->render('<div class="tes...', Array)
#4 /[...]/wp-includes/class-wp-block-type.php(109): LazyBlocks_Blocks->render_callback(Array, '')
#5 /[...]/wp-includes/blocks.php(193): WP_Block_Type->render(Array, '')
#6 /[...]/wp-content/plugins/lazy-blocks/vendor/Handlebars/Template.php on line 497
it seems that the helper action is called too late
We are trying to build bootstrap v3.3.7 accordion. It required dynamic div ID and anchor href value.
https://getbootstrap.com/docs/3.3/javascript/#collapse-example-accordion. Can we get repeater index in handlebar? Like below:
{{#each index in control_name}}
<p>{{inner_control_name}}</p>
{{/each}}
When the user locks some template but want to add other blocks in content, we need to add a block like Free Block from GCF https://github.com/youknowriad/gcf/blob/master/scripts/fields/fields/free.js
When adding new line or any other tag in back end it is converted to text representation of tag like in code editor or sth like that.
I try to use gallery control in the block and can not figure out how to configure it to be able to edit inserted gallery afterwords (eg. replace images, or delete one of them). Is it possible? Should I put some special markup into Editor HTML field?
As for now I can add images, output them in the content area (using the same HTML as for frontend) but no way to edit gallery. When I leave HTML field black, the button Edit Gallery appears in the editor area, but when I click it nothing happen. When I put some preview HTML into Editor HTML field the button did not appear at all. May be I missed something?
Tested with Gutenberg 4.3 and 4.5.1 Lazy blocks version 1.2.2
Anyway, thank you for the awesome plugin!
Add callback also when blocks are not exported to PHP. Current implementation for only exported blocks: https://lazyblocks.com/documentation/blocks-code/php/
Filter example:
add_filter('lazyblock/my-block/frontend_callback', 'my_block_output');
if ( ! function_exists( 'my_block_output' ) ) :
function my_block_output( $attributes ) {
?>
<div>
Control value: <?php echo esc_html( $attributes['test_control'] ); ?>
</div>
<?php
}
endif;
Using DatePicker from wordpress/components
The plugin is great and very useful. I know the plugin is in early stage but can we have the possibility of getting posts, categories ??
eg. I want to create a testimonial section, for that, I want to select categories and from that categories, I want to get the post. Will that be possible to get all categories ??
The same like in GhostKit, because of improved build performance nk-crew/ghostkit@231ab1f
I'm very new to both word press and PHP development so forgive me but I am trying to get PHP to render on my front end as an alternative to HTML. Tried using the documentation but can't seem to get it figured out.
I have added the code into the frontend HTML editor:
<?php
// filter for Frontend output.
add_filter( 'lazyblock/testing1234/frontend_callback', 'my_block_output');
if ( ! function_exists( 'my_block_output' ) ) :
/**
* Test Render Callback
*
* @param string $output - block output.
* @param array $attributes - block attributes.
*/
function my_block_output( $output, $attributes ) {
ob_start();
?>
<div>
Control value: <?php echo "My Test Code"; ?>
</div>
<?php
return ob_get_clean();
}
endif;
Simply trying to get the example to work but I'm clearly missing something. I have checked that in fact my slug name is "testing1234". Do I need to store a .php somewhere else or update my function.php file somehow. Any help would be greatly appreciated. Thanks!
With enabling setting Filter long URLs
, the preview of the blocks didn't load.
Related topic: https://wordpress.org/support/topic/error-loading-block-preview-object-object/
Hi can you add the srcset attribute to the image block please?
$srcset = wp_get_attachment_image_srcset( $image["id"], $size , true);
personally I use lazy loading plugin so having the width, height, and ratio of an image would be a big plus!
thank you for this amazing plugin, I'm looking forward use it in my next project!
It will prevent errors in Gutenberg editor when a user changed the template.
Hey just wanted to say, VERY dope plugin you've got here. I'm pretty awestruck by how slick this thing already is.
I also wanted to put in a request. Could you add some kind of video or file type control?
I've got a custom multimedia gallery that I made for my personal website using ACF. It takes images, sketchfab embed codes for showing off 3D models in a modal, and muted looping autoplaying videos (instead of using gifs like in a normal gallery as gifs have much worse quality and much higher file sizes)I was playing around with your plugin and seeing if I could convert my stuff over, but I cant from what I can see in your documentation. Would love if you could add that though! Many thanks!
Add an attribute with a unique block ID.
Related topic: https://wordpress.org/support/topic/unique-id-when-adding-more-than-one-lazy-block-on-same-page/
For now available Dashicons, but better to change it to SVG Material icons https://material.io/tools/icons/
Inner Blocks does not work as expected in the Repeater field.
Until there is no option to use more than one Inner Blocks as fields, i recommend to disable the Inner Blocks in the Repeater.
By default, there are few block categories, it would be really great if we can add new block categories.
Reference Link
do_shortcode
works only for frontend output, but will be good to see it in the editor block output.
The range control won't save the new value. When you save the page it says it's saved fine, but if you refresh the page after saving you can see it actually didn't save the value. The default loads fine into both the range and number inputs, along with min and max values.
Looking into it the range has a final type as "string" when WP seems to want it to be "number". Hopefully should be an easy fix.
I need to show in the editor the application of the values of other controls in an element that wraps the drag zone of the Inner Block. Look.
Note: I am aware that it is unnecessary to use the {{{inner_block}}} output in the HTML Editor.
In the editor I have the div set to HTML Editor, appearing below the drop zone and receiving the values of the color fields.
So I think this kind of control deserves a field to get out of the values of the fields in your wrapper. Thus, we give the editor User an adequate experience.
What do you think?
Currently only available Default and Lazy blocks.
I have a block that can be reused in the same page/post. However, I didn't find a way to use the meta feature, because when I have multiple blocks, these blocks controls will have the same meta.
Here's an example:
Block Name: Content
Controls:
- Title (meta: content-title)
- Subtitle (meta: content-subtitle)
Page: Home
Blocks:
- Content
-- Title: This is the title
-- Subtitle: This is the subtitle
- Content
-- Title: This is the second title
-- Subtitle: This is the second subtitle
In the render callback, $attributes for innerBlock are empty even if innerBlock is present.
Should return the innerBlock object instead.
Hi there,
The below lines throw PHP 7.3 warnings:
continue statements targeting switch control flow structures will now generate a warning. In PHP such continue statements are equivalent to break, while they behave as continue 2 in other languages.
Unfortunately, the handlebars library is no longer being supported: https://github.com/XaminProject/handlebars.php
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.