src/AppBundle/Twig/SearchExtension.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Twig;
use Biz\System\Service\SettingService;
use Codeages\Biz\Framework\Context\Biz;
use Symfony\Component\DependencyInjection\ContainerInterface;
class SearchExtension extends \Twig_Extension
{
/**
* @var ContainerInterface
*/
protected $container;
/**
* @var Biz
*/
protected $biz;
public function __construct(ContainerInterface $container, Biz $biz)
{
$this->container = $container;
$this->biz = $biz;
}
public function getFilters()
{
return array();
}
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('show_search_placeholder', array($this, 'showSearchPlaceholder')),
);
}
public function showSearchPlaceholder()
{
$cloudSearchSetting = $this->getSettingService()->get('cloud_search', array());
$types = !empty($cloudSearchSetting['type']) ? $cloudSearchSetting['type'] : array();
$placeholderArray = array();
if (!empty($types) && is_array($types)) {
foreach ($types as $type => $value) {
if ($value) {
if ('classroom' == $type) {
$classroomSetting = $this->getSettingService()->get('classroom', array());
$placeholderArray[] = empty($classroomSetting['name']) ? $this->container->get('translator')->trans('cloud_search.'.$type) : $classroomSetting['name'];
} else {
$placeholderArray[] = $this->container->get('translator')->trans('cloud_search.'.$type);
}
}
}
}
return implode('、 ', $placeholderArray);
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。