Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 748 Bytes

inky-components.md

File metadata and controls

34 lines (27 loc) · 748 Bytes

Custom Inky Components

The Inky syntax is parsed using the prezent/inky library. You can add your own custom components to the parser by registering them as a service and tagging them with the prezent_ink.inky_component tag.

<?php

namespace AppBundle\Inky;

use Prezent\Inky\Component\ComponentFactory;

class TestComponentFactory implements ComponentFactory
{
    public function getName()
    {
        return 'test' // name of the html tag.
    }

    public function parse(\DOMNode $element)
    {
        // ...
    }
}
<!-- services.xml -->
<service id="AppBundle\Inky\TestComponentFactory">
    <tag name="prezent_ink.inky_component"/>
</service>