2017 © Pedro Peláez
 

library hook-bundle

provide hook on twig template

image

fys/hook-bundle

provide hook on twig template

  • Tuesday, April 4, 2017
  • by farizsyahputra
  • Repository
  • 1 Watchers
  • 3 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

FYS Hook Bundle

Description

FYS Hook Bundle allows you to make a hook and simply call it in twig templating engine, (*1)

Installation

composer require fys/hook-bundle

Creating first hook

first, create a service that tagged to hook.type, (*2)

// services.yml

app.hook.head:
    class: AppBundle\Component\Hooks\HeadHook
    tags:
        - { name: hook.type }

second, create the class that you mentioned in the service, (*3)

// AppBundle/Component/Hooks/HeadHook.php

namespace AppBundle/Component/Hooks;

use FYS\HookBundle\Component\HookInterface;

class HeadHook implements HookInterface
{
    public function getName()
    {
        // the hook name, for example "head"
        return 'head';
    }

    pubilc function getAction()
    {
        // the action when the hook is called
        return 'HELLO THIS IS MY FIRST HOOK';
    }

    public function getPriority()
    {   
        // the priority of this hook
        return 1;
    }
}

note: the hook class should implements HookInterface then, you can call {{ call_hook('head') }} in twig template, it will print "HELLO THIS IS MY FIRST HOOK", (*4)

The Versions

04/04 2017

dev-master

9999999-dev

provide hook on twig template

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

29/04 2016

dev-develop

dev-develop

provide hook on twig template

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

29/04 2016

1.0.1

1.0.1.0

provide hook on twig template

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

29/04 2016

1.0.0

1.0.0.0

provide hook on twig template

  Sources   Download

MIT

The Requires

  • php >=5.3.0