Download the PHP package gebruederheitz/wp-gutenberg-blocks without Composer

On this page you can find all versions of the php package gebruederheitz/wp-gutenberg-blocks. 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 wp-gutenberg-blocks

Wordpress Gutenberg Blocks Helper

Helps you get your blocks on the road

Find it on packagist: https://packagist.org/packages/gebruederheitz/wp-gutenberg-blocks


Helps you with registering and rendering your custom Gutenberg blocks and acts as a common interface for libraries providing additional blocks.

Installation

via composer:

Make sure you have Composer autoload or an alternative class loader present.

Usage

Initializing the block registrar

Initialize the registrar singleton (usually in your functions.php):

You may pass an alternative handle and path of your editor script to the constructor:

The script handle defaults to ghwp-gutenberg-blocks, the script path to /js/backend.js. The script path is relative to the theme root (get_template_directory_uri()).

Setting allowed blocks

There are three ways of setting the blocks shown to the user in the editor. If you want to skip all that and simply allow all block types, pass true as the first parameter to the registrar's constructor:

Dynamically through an array

You can also provide a list of allowed blocks via an array (it defaults to an empty array, initially allowing no blocks whatsoever):

Using a configuration file

Alternatively, you may use a YAML configuration file:

The value needs to be an array of strings and on the top level under the key gutenbergAllowedBlocks. You can then pass the file's path (relative to the themes root as returned by get_theme_root() or as an absolute filesystem path) to the registrar's constructor as a string:

Even more dynamically through the filter hook

The third option is to use the filter hook to add allowed blocks (this is what the DynamicBlock class uses to automatically set up its availability). The filter hook will always be called, even if you provide a custom list through one of the methods above:

The parameter $allowedBlocks will contain any blocks already allowed through any of the other methods.

Registering a dynamic block

This all assumes you have defined the editor component, attributes etc. in your editor script and registered the block there using wp.blocks.registerBlockType(). Your save component returns null – and this is where you want to register a dynamic block that is rendered by PHP.

It is possible to allow a theme to override your default template partial for the block (even if your default partial file is outside the theme source directory) through the fifth parameter.

As an alternative you can use the factory method to create a Dynamic Block:

Available Hooks

Class constant hook handle type description
BlockRegistrar:: HOOK_REGISTER_DYNAMIC_BLOCKS ghwp-register-dynamic-blocks filter Extend the provided array with an instance of DynamicBlock to automagically register that block. DynamicBlock does this for you when you call register().
BlockRegistrar:: HOOK_ALLOWED_BLOCKS ghwp-allowed-gutenberg-blocks filter A proxy for WP's own allowed_block_types.
BlockRegistrar:: HOOK_SCRIPT_LOCALIZATION_DATA ghwp-script-localization-data filter Add items that your block requires to the localization data for the editor script.

Development

todo


All versions of wp-gutenberg-blocks with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
symfony/yaml Version ^5.3
gebruederheitz/simple-singleton Version ^1.0
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 gebruederheitz/wp-gutenberg-blocks contains the following files

Loading the files please wait ....