palmiak / timber-acf-wp-blocks

Create Gutenberg blocks from Twig templates and ACF fields.
https://palmiak.github.io/timber-acf-wp-blocks/
MIT License
243 stars 25 forks source link

Not working when installed inside roots/bedrock environment #59

Open mortensassi opened 2 years ago

mortensassi commented 2 years ago

Thanks for your great extension! Unfortunately when i install the plugin in the root of my bedrock setup, my blocks won't get recognized in the backend. However, installing this plugin inside the theme-directory works. I guess it has something to do with timing and if the Timber-Class exists?

palmiak commented 2 years ago

Installing it inside of a theme is the recommended way.

However maybe it could be possible to make it working while installing in the root composer file.

czw., 25 lis 2021, 18:02 użytkownik Moe @.***> napisał:

Thanks for your great extension! Unfortunately when i install the plugin in the root of my bedrock setup, my blocks won't get recognized in the backend. However, installing this plugin inside the theme-directory works. I guess it has something to do with timing and if the Timber-Class exists?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/palmiak/timber-acf-wp-blocks/issues/59, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR34OSOJ7OW3OTAZYZJTQ3UNZT2NANCNFSM5IY7O6FA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mortensassi commented 2 years ago

Yeah you can see bedrock loads first the dependencies but i guess in that moment nor ACF or Timber get recognized. When i think about deployment later, i guess its more suitable when theme-related extensions are part of the theme.

merijnponzo commented 2 years ago

In my bedrock setup it's working with both installation methods (plugin, or directly from autoload)

In my composer

"palmiak/timber-acf-wp-blocks": "^1.15"

don't forget to

composer dump-autoload

after your install

and in my theme

// init timber
$timber = new \Timber\Timber();
// init timber acf blocks
if ( class_exists( 'Timber_Acf_Wp_Blocks' ) ) {
    new Timber_Acf_Wp_Blocks();

}