Skip to content

Instantly share code, notes, and snippets.

@juyal-ahmed
Last active November 21, 2018 18:42
Show Gist options
  • Save juyal-ahmed/e5453a0c58132f15c31db3449bcc88ee to your computer and use it in GitHub Desktop.
Save juyal-ahmed/e5453a0c58132f15c31db3449bcc88ee to your computer and use it in GitHub Desktop.
CakePHP 3.x and Croogo 3.x Creating a Custom Plugin

Creating Plugins For Croogo

sudo bin/cake bake plugin Apps

You will be asked to choose a location of the plugin. Select outermost Plugin/ folder.
Creates proper directory structure for new plugin
Adds entry in config/bootstrap.php file to load newly created plugin It is recommended that you delete entry of newly baked plugin from config/bootstrap.php file as you will be able to enable-disable plugin from UI. The line will look something like:

Plugin::load('Apps', ['bootstrap' => false, 'routes' => true]);

Configure Plugin To Enable – Disable

Copy the example plugin.json file to your custom plugins config directory and edit it accordingly as below:

cp vendor/croogo/croogo/Example/config/plugin.json plugins/Apps/config/

Add Menu For Your Plugin

Copy the Blocks admin_menu.php file to your custom plugins config directory and edit it accordingly as below:

cp vendor/croogo/croogo/Blocks/config/plugin.json plugins/Apps/config/
sudo bin/cake bake model Domains --plugin Apps --table apps_domains --no-fixture --no-test --force
sudo bin/cake bake controller Domains --plugin Apps --prefix Admin --theme Croogo/Core --no-test --force
sudo bin/cake bake template Domains --plugin Apps --prefix Admin --theme Croogo/Core --force

Now visit http://local.croogo-app.com/admin/extensions/extensions-plugins and activate the plugins and see it appears in admin left sidebar main menu.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment