Download the PHP package greenpeace/planet4-plugin-gutenberg-blocks without Composer

On this page you can find all versions of the php package greenpeace/planet4-plugin-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 planet4-plugin-gutenberg-blocks

Greenpeace Planet 4 Gutenberg Blocks Plugin

What is it?

This the WordPress Gutenberg blocks plugin for Greenpeace Planet 4 project. You can learn more about this project on the Planet 4 blog.

Contribute

The best place to start is from the main Planet 4 repo that contains all the necessary information and tickets to get started.

How to use this plugin in Planet 4

You can use the plugin in WordPress directly, by including it in your composer.json file:

Assets build

You'll need npm to install the dependencies, just run npm install to install them.

To develop:

Build Setup

WordPress provides a single dependency for the whole build setup including:

How to develop a new block you ask?

  1. Create a new class that extends Base_Block ( P4GBKS\Blocks\Base_Block ) inside directory classes/blocks. The class name should follow a naming convention, for example, Blockname and its file name should be class-blockname.php.

  2. Implement its parent's class abstract method. In block's constructor, you need to define the block's details (fields, schema) using register_block_type and in method prepare_data() you need to prepare the data which will be used for rendering.

  3. Create the template file that will be used to render your block inside directory templates/blocks. If the name of the file is blockname.twig then you need to set the BLOCK_NAME constant as 'blockname' It also works with HTML templates. Just add 'php' as the 3rd argument of the block() method.

  4. Add your new class name to the array inside Loader's ( P4GBKS\Loader ) constructor.

  5. Create a new folder inside react-blocks/src/blocks named after your block Blockname (first letter capital - rest lowercase). Create two new files inside that folder named Blockname.js and BlocknameBlock.js.

    BlocknameBlock.js should be a class that uses wordpress registerBlockType to define the block's attributes, schema and edit() function. edit() function should return a react component that will be used for rendering the block in the editor. save() function should return null as we use server-side rendering currently.

    Blockname.js should be a class that defines a React component that implements renderEdit() and renderView(). renderEdit() should be used to render the block in the editor, to define editor-specific things as sidebar options, in-place edit components, and so on. renderView() will be used both in the editor and in the frontend site to render the block's contents, as we are rendering blocks using React in the frontend too.

    To learn more details about the rendering logic, refer to the blocks page in Planet 4 Gitbook.

  6. Create a new sccs file inside react-blocks/src/blocks/styles named after your block Blockname.scss to use for block's frontend styling.

    Create a new file named BlocknameEditor.scss to use for block's editor styling if you need to style the block in the editor.

  7. Finally, before committing do npm run build to build the plugin's assets and vendor/bin/phpcs to check for any PHP styling errors in your code.

All versions of planet4-plugin-gutenberg-blocks with dependencies

PHP Build Version
Package Version
No informations.
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 greenpeace/planet4-plugin-gutenberg-blocks contains the following files

Loading the files please wait ....