Download the PHP package wp63/acf-block-loader without Composer
On this page you can find all versions of the php package wp63/acf-block-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download wp63/acf-block-loader
More information about wp63/acf-block-loader
Files in wp63/acf-block-loader
Download wp63/acf-block-loader
More information about wp63/acf-block-loader
Files in wp63/acf-block-loader
Vendor wp63
Package acf-block-loader
Short Description Wrapper class for easy ACF Gutenberg Block registration
License GPL-3.0-or-later
Package acf-block-loader
Short Description Wrapper class for easy ACF Gutenberg Block registration
License GPL-3.0-or-later
Please rate this library. Is it a good library?
Informations about the package acf-block-loader
ACF-Block-Loader
Wrapper class for easy ACF Gutenberg Block registration
Install
Usage
By default, Class file are to be stored inside Blocks
directory in theme root directory (or app\Blocks
in Sage 9). File name should be the same as Classname as in PSR-4.
- Create a class extending
WP63\Block
- Class default namespace is
WP63\Blocks\
- Class must have at least 2 methods:
register()
and staticrender()
register()
method will return an array with 3 keys
$name
block-unique-name$title
Block Title$category
Block category. Predefined categories are [ common | formatting | layout | widgets | embed ] (Optional)$fields
ACF fieldsStoutLogic\AcfBuilder\FieldsBuilder
object. Output ofFieldsBuilder::build()
method.
render()
is the static method for rendering actual block. Every output generated inside this method will be part of block html. Render method will have access to 4 callback arguments from ACF via $options
arguments
- array
$options->block
The block settings and attributes. - string
$options->content
The block inner HTML (empty). - boolean
$options->is_preview
True during AJAX preview. - int|string
$options->post_id
The post ID this block is saved to.
Filters
wp63/acf_block_namespace
Change block namespace. Default:App\Blocks\
wp63/acf_block_directory
Change directory name. Default:./Blocks
wp63/acf_block_template_directory
Change Blade template directory. relative to/views
directory Default:blocks
Actions
wp63/before_block_render
Before each block is renderedwp63/before_block_render/{$block_name}
Before$block_name
is renderedwp63/after_block_render
After each block is renderedwp63/after_block_render/{$block_name}
After$block_name
is rendered
Use with Blade template engine in Sage 9
- In class
render()
method, instead of echo output directly, return an array contains all data to be exposed to Blade template file. - Create template file in
views/blocks
the file name must be the same as block nam3 ($name
). for example:views/blocks/hero-banner.blade.php
All versions of acf-block-loader with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.1
The package wp63/acf-block-loader contains the following files
Loading the files please wait ....