gintonicweb / makeup
Adds flexibility to cakephp themes and paths
Installs: 113
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Type:cakephp-plugin
Requires (Dev)
- cakephp/cakephp: ~3.0
- phpunit/phpunit: ~4.1
This package is not auto-updated.
Last update: 2019-02-20 18:51:53 UTC
README
Makeup allows to change the way CakePHP resolves view paths with the help of a configuration array. The goal of this plugin is to improve the reusability of themes and reduce the folder-nesting madness of large applications.
- Easily map prefixes to themes
- Override themes from the application
- Reuse a theme across prefixes with different overrides
- Choose your own folder structure
- Fallback on traditional cakephp paths
Install
Using Composer:
composer require gintonicweb/makeup:dev-master
You then need to load the plugin. You can use the shell command:
bin/cake plugin load Gintonic/Makeup
or by manually adding statement shown below to your app's config/bootstrap.php
:
Plugin::load('Gintonic/Makeup');
Usage
Add the MakeupViewTrait to your AppView, and use the $themes
variable to map
variables.
class AppView extends CrudView
{
use \Gintonic\Makeup\View\MakeupViewTrait;
protected $themes = [
'Default' => [
'MyDefaultFolder' => 'DefaultTheme'
],
'Admin' => [
'MyAdminFolder' => 'AdminTheme'
],
];
}
In the case above :
Default
This is a constant defined by Makeup, representing all non-prefixed pagesAdmin
Represents the Admin prefixMyDefaultFolder
andMyAdminFolder
are folders found undersrc/Template/
where you can override themesDefaultTheme
andAdminTheme
are the names of 2 themes.
Patches & Features
- Fork
- Mod, fix
- Test - this is important, so it's not unintentionally broken
- Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
- Pull request - bonus point for topic branches
To ensure your PRs are considered for upstream, you MUST follow the CakePHP coding standards.
Bugs & Feedback
http://github.com/gintonicweb/makeup/issues
License
Copyright (c) 2015, Gintonic and licensed under The MIT License.