Skip to content

WordPress plugin that creates all the Shortcake UI blocks for the Greenpeace Planet4 project

License

Notifications You must be signed in to change notification settings

Wakkatela/planet4-plugin-blocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Greenpeace Planet4 Blocks Plugin

Planet4

Introduction

This WordPress plugin provides the necessary blocks to be used with Shortcake UI plugin.

How to develop a new block you ask?

  1. Create a new controller class that extends Controller inside directory classes/controller/blocks. The class name should follow naming convention, for example Blockname_Controller and its file name should be class-blockname-controller.php.

  2. Implement its parent's class two abstract methods. In method prepare_fields() you need to define the blocks fields 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 includes/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 that the Loader function takes as an argument in the plugin's main file.

  5. Finally, before committing do composer update --no-dev and composer dump-autoload --optimize in order to add your new class to composer's autoload.

Contribute

Please read the Contribution Guidelines for Planet4.

About

WordPress plugin that creates all the Shortcake UI blocks for the Greenpeace Planet4 project

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published