Comments (5)
I need to undestand the documentation at https://www.advancedcustomfields.com/resources/blocks/
from acf-oik-blocks.
The first version of the block is now available.
It's dependent upon oik for the actual logic to generate the PayPal button.
Obviously it's also dependent upon ACF-Pro for the logic that
- enables registration of the block
- turns the ACF field group into the block's Settings panel
PayPal block settings for the Pay Now button.
ACF Pro fields group "PayPal".
from acf-oik-blocks.
Notes to self.
Question: How does ACF block rendering work?
- acf_register_block_type() registers each block with the
render_callback
arg to setacf_render_block_callback
. acf_render_block_callback()
sets values for$is_preview
and$post_id
then callsacf_rendered_block()
- It uses output buffering to capture the output from the block's callback function or template which is invoked by
acf_render_block()
. acf_render_block()
also enqueues assets defined for the block.
Question: How does the settings panel for ACF blocks work?
This is the magic that's hidden from the normal owner of the plugin since the invoking code is JavaScript that's been built from source code that's not part of the runtime package.
- The Settings area is populated after an AJAX call with action
acf/ajax/fetch-block
from_acf-blocks.js
. - This is implemented by
acf_ajax_fetch_block()
which uses a number of acf functions to render the fields associated with the block; acf_get_block_fields, acf_render_fields etc. - There are lots of filters that you can hook into, if you so wish.
- The AJAX call returns the HTML in
data.form
- And ACF's react code shows these fields in the Settings area.
Since I don't have access to the source code I'm not going to investigate any further. Suffice it to say, ACF does quite a lot of work in some generic code that would otherwise have to be written in JavaScript for each block.
from acf-oik-blocks.
Donate button previewed in the block editor.
Donate button in Edit mode, basically the same as the Settings panel with a little extra styling.
from acf-oik-blocks.
Closing this for now. The block is dependent upon oik. I could improve it to remove the dependency but I've got other things to do.
from acf-oik-blocks.
Related Issues (2)
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 acf-oik-blocks.