Coder Social home page Coder Social logo

nk-crew / lazy-blocks Goto Github PK

View Code? Open in Web Editor NEW
338.0 338.0 41.0 9.55 MB

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

JavaScript 32.83% PHP 61.73% SCSS 5.27% Shell 0.01% HTML 0.08% CSS 0.08%
blocks custom gutenberg wordpress

lazy-blocks's People

Contributors

cutch avatar dependabot[bot] avatar fellan-91 avatar jinook929 avatar nk-o avatar pharmarin avatar zolliepy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lazy-blocks's Issues

Bug? Template no actions

image

I created one template test and now dont exists any actions for this item. What happened?

I can't do nothing.. delete, edit...

Issue on Img

Hi! I am using the latest version in of your plugin, but I have problem with the field type img, here is my setting:
descarga 1

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!

Enhancement: Add support for showing/hiding fields with a toggle field

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:

screenshot 2018-11-06 at 10 43 56

Keep up the good work and this plugin can become huge 🙃 !

New controls

  • Date (Time) picker
  • Color picker
  • URL selector (the same like in default Button block)
  • Rich Text (WYSIWYG)
  • InnerBlocks to add inside this block all available blocks.
  • Font size picker
  • Icon picker (FontAwesome by default)
  • Multiple checkboxes / radio buttons

Bug ? apostrophe in post title prevent publishing in 1.4.0

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.

lzb/handlebars/object action

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

Edit gallery inserted with Gallery control

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!

Filter to add custom PHP render callback

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;

Get post,categories,taxonomies

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 ??

PHP Front-End render

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!

srcset in image block

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!

Enhancement Request: Add video control type

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!

Disable Inner Blocks in Repeater

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.

Range control won't save value

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.

core/latest-posts
image

lazyblock/postcards
image

Feature Request: Output control values on Inner Blocks wrapper

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.
image

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.
image

In forntend this all right:
image

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?

Working with meta and multiple 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

PHP 7.3 continue switch warnings

Hi there,

The below lines throw PHP 7.3 warnings:

https://github.com/nk-o/lazy-blocks/blob/97a5ab6c7e294ec1e77a0507d1b1e3276510f558/src/vendor/Handlebars/Tokenizer.php#L167

https://github.com/nk-o/lazy-blocks/blob/97a5ab6c7e294ec1e77a0507d1b1e3276510f558/src/vendor/Handlebars/Tokenizer.php#L213

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.

http://php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.continue-targeting-switch

Unfortunately, the handlebars library is no longer being supported: https://github.com/XaminProject/handlebars.php

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.