Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gutenberg blocks not working on WP 5.3 #779

Closed
rafaucau opened this issue Oct 25, 2019 · 7 comments
Closed

Gutenberg blocks not working on WP 5.3 #779

rafaucau opened this issue Oct 25, 2019 · 7 comments

Comments

@rafaucau
Copy link

rafaucau commented Oct 25, 2019

Version

  • Carbon Fields: 3.1.6
  • WordPress: 5.3
  • PHP: 7.3

Actual Behavior

Custom blocks do not appear in the editor on WP 5.3. No errors in PHP and console.

Container definition

use Carbon_Fields\Block;

Block::make( __( 'My Shiny Gutenberg Block' ) )
    ->add_fields( array(
        Field::make( 'text', 'heading', __( 'Block Heading' ) ),
        Field::make( 'image', 'image', __( 'Block Image' ) ),
        Field::make( 'rich_text', 'content', __( 'Block Content' ) ),
    ) )
    ->set_render_callback( function ( $fields, $attributes, $inner_blocks ) {
        ?>

        <div class="block">
            <div class="block__heading">
                <h1><?php echo esc_html( $fields['heading'] ); ?></h1>
            </div><!-- /.block__heading -->

            <div class="block__image">
                <?php echo wp_get_attachment_image( $fields['image'], 'full' ); ?>
            </div><!-- /.block__image -->

            <div class="block__content">
                <?php echo apply_filters( 'the_content', $fields['content'] ); ?>
            </div><!-- /.block__content -->
        </div><!-- /.block -->

        <?php
    } );

Steps to Reproduce the Problem

  1. Install WP 5.3 Beta
  2. Try adding custom block
  3. The block don't appear in the editor

Comments

I know that WordPress 5.3 is still a beta version, but I am reporting earlier so that there will be no problems after the official update

@jorostoyanov
Copy link
Contributor

Hi @rafaucau

Can you try setting the icon for your block via ->set_icon( 'book-alt' ). This should resolve the issue.

@drzraf
Copy link

drzraf commented Jan 1, 2020

Same annoying issue here. (no log, no error, no trace of why block does not seem registered).
I'm using add_action( 'carbon_fields_register_fields', function() { ...}, 50 );

I see block registration if, within wp_head, I

var_dump( WP_Block_Type_Registry::get_instance()->get_all_registered() );

Why was this issue closed?

@rafaucau
Copy link
Author

rafaucau commented Jan 1, 2020

@drzraf

Why was this issue closed?

It's already fixed. Maybe you have an old version of Carbon Fields.
Run composer update command and check again

@drzraf
Copy link

drzraf commented Jan 1, 2020

I'm using the latest CBF 3.1.8 + WP 5.3.2
(Latest of https://packagist.org/packages/htmlburger/carbon-fields-plugin)

I can't see the block at /wp-json/wp/v2/blocks (shouldn't I ?)

@rafaucau
Copy link
Author

rafaucau commented Jan 1, 2020

@drzraf
Have you checked on the minimum WP installation? With all plugins disabled.

Eg. Google Site Kit plugin breaks Carbon Fields:
https://wordpress.org/support/topic/site-kit-breaks-carbon-fields-gallery-field/

@drzraf
Copy link

drzraf commented Jan 1, 2020

#786 ? I'm indeed seeing TypeError: cf.core is undefined.

@alimoshen
Copy link

@drzraf

Why was this issue closed?

It's already fixed. Maybe you have an old version of Carbon Fields.
Run composer update command and check again

Thanks @drzraf, the composer update did the trick for me! Was about to give up and revert back to ACF 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants