2017 © Pedro Peláez
 

library themes

Themes support for Annotate Framework

image

annotate/themes

Themes support for Annotate Framework

  • Sunday, January 21, 2018
  • by vysinsky
  • Repository
  • 3 Watchers
  • 3 Stars
  • 249 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Travis Code Climate Code Climate, (*1)

Packagist Packagist Packagist Packagist, (*2)

Themes package for Annotate Framework

This package provides powerfull themes support. You can create theme and override every template in theme., (*3)

Requirements

Themes extension requires annotate/templating. Register its extension to your neon config too., (*4)

Installation

Require this extension by Composer, (*5)

$ composer require annotate/themes:~2.1.0

Register extension into configuration:, (*6)

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:, (*7)

themes:
    directory: %appDir%/app/

Now edit any of your presenters:, (*8)

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:, (*9)

name: My theme

Inheritance

Themes support one level inheritance you can specify parent theme by extends option in neon file:, (*10)

name: My theme
extends: theme

Loading templates

After activating theme app will search for template files this way:, (*11)

  1. search for %themeDir%/templates/%templateName
  2. in case theme extends another theme it seaches for %anotherThemeDir%/templates/%templateName%
  3. if no template was found above it searches for file in normal "Nette" way

The Versions