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
$nameblock-unique-name$titleBlock Title$categoryBlock category. Predefined categories are [ common | formatting | layout | widgets | embed ] (Optional)$fieldsACF fieldsStoutLogic\AcfBuilder\FieldsBuilderobject. 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->blockThe block settings and attributes. - string
$options->contentThe block inner HTML (empty). - boolean
$options->is_previewTrue during AJAX preview. - int|string
$options->post_idThe post ID this block is saved to.
Filters
wp63/acf_block_namespaceChange block namespace. Default:App\Blocks\wp63/acf_block_directoryChange directory name. Default:./Blockswp63/acf_block_template_directoryChange Blade template directory. relative to/viewsdirectory Default:blocks
Actions
wp63/before_block_renderBefore each block is renderedwp63/before_block_render/{$block_name}Before$block_nameis renderedwp63/after_block_renderAfter each block is renderedwp63/after_block_render/{$block_name}After$block_nameis 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/blocksthe 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 ...