mirror of
https://github.com/openclassify/openclassify.git
synced 2026-04-17 12:42:12 -05:00
40 lines
967 B
PHP
40 lines
967 B
PHP
<?php namespace Visiosoft\CatsModule;
|
|
|
|
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
|
use Visiosoft\CatsModule\Category\Command\GetCategoryName;
|
|
use Visiosoft\CatsModule\Category\Command\GetCategoryDetail;
|
|
|
|
class CatsModulePlugin extends Plugin
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getFunctions()
|
|
{
|
|
return [
|
|
new \Twig_SimpleFunction(
|
|
'category_name',
|
|
function ($id) {
|
|
|
|
if (!$ad = $this->dispatch(new GetCategoryName($id))) {
|
|
return null;
|
|
}
|
|
|
|
return $ad;
|
|
}
|
|
),new \Twig_SimpleFunction(
|
|
'category_detail',
|
|
function ($id) {
|
|
|
|
if (!$ad = $this->dispatch(new GetCategoryDetail($id))) {
|
|
return null;
|
|
}
|
|
|
|
return $ad;
|
|
}
|
|
)
|
|
];
|
|
}
|
|
}
|