当前位置: 首页>>代码示例>>PHP>>正文


PHP EngineInterface::exists方法代码示例

本文整理汇总了PHP中Symfony\Component\Templating\EngineInterface::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP EngineInterface::exists方法的具体用法?PHP EngineInterface::exists怎么用?PHP EngineInterface::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Templating\EngineInterface的用法示例。


在下文中一共展示了EngineInterface::exists方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadResourceFromTheme

 /**
  * Tries to load the resource for a block from a theme.
  *
  * @param string $cacheKey  The cache key for storing the resource.
  * @param string $blockName The name of the block to load a resource for.
  * @param mixed  $theme     The theme to load the block from.
  *
  * @return bool    True if the resource could be loaded, false otherwise.
  */
 protected function loadResourceFromTheme($cacheKey, $blockName, $theme)
 {
     if ($this->engine->exists($templateName = $theme . '/' . $blockName . '.html.php')) {
         $this->resources[$cacheKey][$blockName] = $templateName;
         return true;
     }
     return false;
 }
开发者ID:phpextra,项目名称:silex-view-provider,代码行数:17,代码来源:FormRendererEngine.php

示例2: getTemplatePath

 /**
  * Locates the applicable template and returns its path.
  * @return string The template path.
  */
 protected function getTemplatePath()
 {
     $paths = ['@custom_webindex_templates/' . self::DEFAULT_TEMPLATE_NAME];
     foreach ($paths as $path) {
         if ($this->templatingEngine->exists($path)) {
             return $path;
         }
     }
     return 'IliosWebBundle:WebIndex:' . self::DEFAULT_TEMPLATE_NAME;
 }
开发者ID:stopfstedt,项目名称:ilios,代码行数:14,代码来源:WebIndexFromJson.php

示例3: findTemplate

 /**
  * Finds the template in all the bundles.
  *
  * @param string $templatePath The template to search.
  *
  * @return bool|string The string found or false if not found
  */
 protected function findTemplate($templatePath)
 {
     foreach ($this->bundles as $bundleName) {
         $templateName = "{$bundleName}:{$templatePath}";
         if ($this->engine->exists($templateName)) {
             return $templateName;
         }
     }
     return false;
 }
开发者ID:elcodi,项目名称:bamboo,代码行数:17,代码来源:TemplateLocator.php

示例4: formatColumn

 /**
  * @param $element
  * @param $columnName
  * @return string
  * @throws Exception
  */
 private function formatColumn($element, $columnName)
 {
     $nameArray = explode('.', $columnName);
     $columnName = $nameArray[0];
     $view = $this->repository->getTemplatesPath() . $columnName . '.html.twig';
     if ($this->templating->exists($view)) {
         return $this->templating->render($view, ['element' => $element]);
     }
     if (method_exists($element, $columnName)) {
         return $element->{$columnName}();
     }
     $getter = 'get' . ucfirst($columnName);
     if (!method_exists($element, $getter)) {
         throw new Exception($this->translator->trans(self::ERROR_NO_ELEMENT_RENDER_INFO) . ': ' . $columnName);
     }
     $result = $element->{$getter}();
     if (!isset($nameArray[1])) {
         if ($result instanceof \DateTime) {
             return $result->format('d.m.Y');
         }
         return $result;
     }
     unset($nameArray[0]);
     return $result ? $this->formatColumn($result, implode('.', $nameArray)) : '';
 }
开发者ID:jasuwienas,项目名称:DataTable,代码行数:31,代码来源:DataTableListService.php

示例5: src

 /**
  * Gets the RequireJS src
  *
  * @return string Returns a string that represents the RequireJS src
  */
 public function src()
 {
     if ($this->engine->exists($this->requireJsSrc) && $this->engine->supports($this->requireJsSrc)) {
         return $this->engine->render($this->requireJsSrc);
     }
     return $this->requireJsSrc;
 }
开发者ID:BRS-software,项目名称:HearsayRequireJSBundle,代码行数:12,代码来源:RequireJSHelper.php

示例6: getTemplatePath

 /**
  * Locates the applicable message template for a given school and returns its path.
  * @param SchoolInterface $school
  * @return string The template path.
  */
 protected function getTemplatePath(SchoolInterface $school)
 {
     $paths = ['@custom_email_templates/' . basename($school->getTemplatePrefix() . '_' . self::DEFAULT_TEMPLATE_NAME), '@custom_email_templates/' . self::DEFAULT_TEMPLATE_NAME];
     foreach ($paths as $path) {
         if ($this->templatingEngine->exists($path)) {
             return $path;
         }
     }
     return 'IliosCoreBundle:Email:' . self::DEFAULT_TEMPLATE_NAME;
 }
开发者ID:Okami-,项目名称:ilios,代码行数:15,代码来源:SendTeachingRemindersCommand.php

示例7: locateTemplate

 /**
  * Search for the template in every specified bundle
  *
  * @return string Found existing template name
  */
 private function locateTemplate()
 {
     foreach ($this->bundles as $bundleName) {
         $templateName = "{$bundleName}:{$this->templatePath}";
         if ($this->engine->exists($templateName)) {
             return $templateName;
         }
     }
     throw new RuntimeException(sprintf('Template "%s" not found', $this->templatePath));
 }
开发者ID:axelvnk,项目名称:elcodi,代码行数:15,代码来源:TemplatedPageRenderer.php

示例8: src

 /**
  * Gets the RequireJS src
  *
  * @return string Returns a string that represents the RequireJS src
  */
 public function src()
 {
     try {
         if ($this->engine->exists($this->requireJsSrc) && $this->engine->supports($this->requireJsSrc)) {
             return $this->engine->render($this->requireJsSrc);
         }
     } catch (\InvalidArgumentException $err) {
     }
     return $this->requireJsSrc;
 }
开发者ID:boskee,项目名称:HearsayRequireJSBundle,代码行数:15,代码来源:RequireJSHelper.php

示例9: getTemplate

 /**
  * Returns export template for given format like XLIFF1.2.
  *
  * @param $format
  *
  * @return string
  *
  * @throws \Exception
  */
 protected function getTemplate($format)
 {
     if (!isset($this->formatFilePaths[$format])) {
         throw new \Exception(sprintf('No format "%s" configured for webspace export', $format));
     }
     $templatePath = $this->formatFilePaths[$format];
     if (!$this->templating->exists($templatePath)) {
         throw new \Exception(sprintf('No template file "%s" found for webspace export', $format));
     }
     return $templatePath;
 }
开发者ID:sulu,项目名称:sulu,代码行数:20,代码来源:Webspace.php

示例10: renderLocationEmbed

 public function renderLocationEmbed($locationId, $viewType, array $parameters, $isInline)
 {
     $isDenied = false;
     try {
         $location = $this->checkLocation($locationId);
         if ($location->invisible) {
             if (isset($this->logger)) {
                 $this->logger->error("Could not render embedded resource: Location #{$locationId} is not visible");
             }
             return null;
         }
     } catch (AccessDeniedException $e) {
         if (isset($this->logger)) {
             $this->logger->error("Could not render embedded resource: access denied to embed Location #{$locationId}");
         }
         $isDenied = true;
     } catch (Exception $e) {
         if ($e instanceof NotFoundHttpException || $e instanceof NotFoundException) {
             if (isset($this->logger)) {
                 $this->logger->error("Could not render embedded resource: Location #{$locationId} not found");
             }
             return null;
         } else {
             throw $e;
         }
     }
     $templateName = $this->getEmbedTemplateName(static::RESOURCE_TYPE_LOCATION, $isInline, $isDenied);
     if ($templateName === null) {
         $this->logger->error('Could not render embedded resource: no template configured');
         return null;
     }
     if (!$this->templateEngine->exists($templateName)) {
         if (isset($this->logger)) {
             $this->logger->error("Could not render embedded resource: template '{$templateName}' does not exists");
         }
         return null;
     }
     return $this->render($templateName, $parameters);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:39,代码来源:Renderer.php

示例11: getTemplate

 /**
  * @param string $template
  * @param array  $parameters
  *
  * @return null|string
  */
 protected function getTemplate($template, array $parameters = [])
 {
     return $this->templating->exists($template) ? $this->templating->render($template, $parameters) : null;
 }
开发者ID:csbill,项目名称:csbill,代码行数:10,代码来源:Mailer.php

示例12: exists

 public function exists($name)
 {
     return $this->engine->exists($name);
 }
开发者ID:foreverglory,项目名称:admin-bundle,代码行数:4,代码来源:TwigEngine.php


注:本文中的Symfony\Component\Templating\EngineInterface::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。