Skip to content

The FrctlTwigExtension component allows you set seamlessly integrate your Fractal twig templates.

License

Notifications You must be signed in to change notification settings

lbochsler/frctl_twig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FrctlTwigExtension

The FrctlTwigExtension component allows you set seamlessly integrate your Fractal twig templates.

Installation

To install the latest stable version of this component, open a console and execute the following command:

$ composer require candoimage/frctl_twig

Usage

The first step is to register the extension in the twig environment

services:
    Frctl\Twig\Extension\FrctlTwigExtension:
        tags:
            - { name: twig.extension }

or manually in your code

/* @var $twig Twig_Environment */
$twig->addExtension(new Frctl\Twig\Extension\FrctlTwigExtension());

Then you need to configure the new include namespace the fractal templates:

twig:
  paths:
    '%kernel.project_dir%/../frontend/src/components': FrctlTwig

or manually in your code

$loader->addPath(dirname(__DIR__) . '/../frontend/src/components', 'FrctlTwig');

Once registered, you can use the new render tag seamlessly in your twig templates:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>title</title>
  </head>
  <body>
    {% render "@component" with {some: 'values'} %}
  </body>
</html>

License

This component is under the MIT license. See the complete license in the LICENSE file.

Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker.

Author Information

Peter Philipp @ Cando Image.

If you find this component useful, please add a ★ in the GitHub repository page.

About

The FrctlTwigExtension component allows you set seamlessly integrate your Fractal twig templates.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%