annotatecms / themes
Themes support for Annotate Framework
Requires
- php: >=5.6
- annotate/diagnostics: @dev
- annotate/templating: @dev
- kdyby/events: ^3.1
- nette/application: ~2.4.0
- nette/bootstrap: ~2.4.0
- nette/di: ~2.4.0
- nette/finder: ~2.4.0
- tracy/tracy: ~2.4.0
Requires (Dev)
- codeclimate/php-test-reporter: @dev
- dotblue/codesniffer-ruleset: @dev
- jakub-onderka/php-console-highlighter: 0.*
- jakub-onderka/php-parallel-lint: 0.*
- latte/latte: ~2.4.0
- nette/tester: @dev
- phpspec/prophecy: ~1.4
- squizlabs/php_codesniffer: ^3.0
This package is not auto-updated.
Last update: 2022-02-01 13:15:58 UTC
README
Themes package for Annotate Framework
This package provides powerfull themes support. You can create theme and override every template in theme.
Requirements
Themes extension requires annotate/templating. Register its extension to your neon config too.
Installation
Require this extension by Composer
$ composer require annotate/themes:~2.1.0
Register extension into configuration:
extensions: templating: Annotate\Templating\DI\TemplatingExtension themes: Annotate\Themes\DI\ThemesExtension
Configure
Themes path is configurable via Neon. Default directory
value is %appDir%/app/addons/themes/
.
To change themes open app/config/app.neon and add following configuration:
themes:
directory: %appDir%/app/
Now edit any of your presenters:
class FrontendPresenter extends Nette\Application\UI\Presenter
{
use Annotate\Themes\ThemedPresenter;
/** @var Annotate\Themes\Loaders\ThemesLoader @inject */
public $themesLoader;
public function startup()
{
parent::startup();
$this->themesLoader->activateTheme('theme name');
}
}
Create theme
Create a file theme_name.theme.neon
in themes directory with minimal structure:
name: My theme
Inheritance
Themes support one level inheritance you can specify parent theme by extends
option in neon file:
name: My theme extends: theme
Loading templates
After activating theme app will search for template files this way:
- search for
%themeDir%/templates/%templateName
- in case theme extends another theme it seaches for
%anotherThemeDir%/templates/%templateName%
- if no template was found above it searches for file in normal "Nette" way