nepttune/base-component

Base component for Nepttune

v4.7 2018-08-03 12:03 UTC

README

🅱️ Base component for Nepttune

Packagist Packagist CommitsSinceTag

Code Climate Scrutinizer Code Quality

Functionality

This package contains base component class with extended functionality.

  • Overriden render() method automatically finds component's template file by replacing .php fil extension with .latte.
    • Custom path can be specified by overriding TEMPLATE_PATH class constant.
  • Introducing beforeRender() method, which is called before the render() method.
  • Overriden createComponent method automates creation of components. If the createComponent<Name> is not found, parent's (in the componenet tree) createComponent is called.

Package also contains Translator injection helpers.

Dependencies

How to use

  • Extend \Nepttune\Component\BaseComponent if you with to use functionality of the class.
  • If you with to use Translator injection helpers, place following code in your configuration file, implement \Nepttune\TI\ITranslator interface and use \Nepttune\TI\TTranslator trait in selected presenter/component.
decorator:
    Nepttune\TI\ITranslator:
        setup:
            - injectTranslator