Download the PHP package itinerisltd/acf-gutenblocks without Composer

On this page you can find all versions of the php package itinerisltd/acf-gutenblocks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package acf-gutenblocks

acf-gutenblocks

Packagist Version PHP from Packagist Packagist Downloads GitHub License Hire Itineris

Easily create Gutenberg Blocks with Advanced Custom Fields.

Minimum Requirements

Installation

Usage

  1. Activate the plugin
  2. Create a directory to store your Blocks in your plugin or theme
  3. Define your Block and frontend template

  4. Register your Block by appending the Block class name as a string to the acf_gutenblocks/blocks filter

Block definition

Blocks are registered using PHP classes to provide a simple "Controller" to allow separation of logic and functionality from your template. This can really help to isolate and organise code that is intended only for that Block.

To create a Block, you must extend your class from the available Block constructors and pass any valid acf_register_block() arguments to the parent constructor. Here can also define your controller methods for use within your template.

Block constructors

AbstractBlock

Extend from this class to register a vanilla PHP template.

AbstractBladeBlock

If your project uses the Sage theme, you can take advantage of Blade templating by extending from this class (in future, Sage will be optional).

The isValid method will look for \App\template. If you're in a Sage environment where that doesn't exist (i.e. Sage 10), you can use the acf_gutenblocks/blade_engine_callable filter to return a different callable.

Template data

Your Block constructor class is available to your template via $controller. This allows you to create truly advanced Blocks by organising all of your functional code and logic into a place where you can take more advantage of an OOP approach.

Additionally, the with() method lets you pass variables to your template. To create a variable for your template, create a key+value pair in the with() method:

Using $items in your template:

Fields

You can define your ACF fields in your Block by returning an array of fields in the registerFields method.

Simple array

Read more here.

ACF Builder

Filters

acf_gutenblocks/blocks - (array $blocks)

The Block Loader. Use this to load and register your Block classes.

acf_gutenblocks/get_initializables - (array $initializables)

Called before looping Blocks and checking if they are valid to load.

acf_gutenblocks/render_block_frontend_path - (string $path, Block $block)

Used to change the frontend view path.

acf_gutenblocks/render_block_html_output - (string $html, Block $block)

For use with AbstractBlock. Allows manipulating the frontend view HTML after being included.

acf_gutenblocks/default_icon - (string $icon)

Used to change the default icon.

acf_gutenblocks/block_settings - (array $settings, string $name)

Change the ACF Block settings registered in the Block before initialising it.

FAQ

Can I use a different template rendering option?

You could make a copy of AbstractBlock, rename it and define your own renderBlockCallback method. Just make sure your Block class extends from it.

Do I need to adhere to any structure or standard?

You can manage your Blocks any way you wish. This README will use our preferred approach of strict typing and the directory structure.

Why not load all Blocks from a given directory? It's much easier!

Using directory scanning options like glob and DirectoryIterator (or other Iterators) will have a performance impact within your application. There are many reasons for that, but the most simple ones are that they take arguments that must be read and dealt with before getting to the actual directory scanning.

Manually loading your Blocks also means that you as a developer are more aware of what you are loading and can do things like conditional logic of loading your Blocks.

My Blade template doesn't load.

Check your PHP error logs and that your installation is valid for use with Sage.

Author Information

acf-gutenblocks is a Itineris Limited project created by Lee Hanbury-Pickett.

Shout out to @nicoprat with his article which kickstarted this.

Thanks to @mmirus for pointers and giving me the idea for this package.

Full list of contributors can be found here.

Feedback

Please provide feedback! We want to make this library useful in as many projects as possible. Please submit an issue and point out what you do and don't like, or fork the project and make suggestions. No issue is too small.

Change log

Please see CHANGELOG for more information on what has changed recently.

License

acf-gutenblocks is released under the MIT License.


All versions of acf-gutenblocks with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
composer/installers Version ^1.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package itinerisltd/acf-gutenblocks contains the following files

Loading the files please wait ....