PHP code example of scylabs / hook-bundle

1. Go to this page and download the library: Download scylabs/hook-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

scylabs / hook-bundle example snippets


public function showHook(string $template,string $hookName)



namespace App\Hook;


use ScyLabs\HookBundle\Model\AbstractHook;

class MyHook extends AbstractHook
{

    // name of the doors where the hook will be injected
    public function getNames(): array {
        return [
            'my_custom_hook'
        ];
    }

    // A priority 0 hook will be placed before a priority 1 hook
    public function getPriority(): int {
        return 0;
    }

    // Hook result. The result are injected in door template. You can also do anything you sant in this function.
    public function showHook() {
        // $this->render() controller function equivalent.
        return $this->render('hook/menu.html.twig',[]);
    }
}