Symfony\Component\Templating\EngineInterface::exists PHP Method

exists() public method

Returns true if the template exists.
public exists ( mixed $name ) : boolean
$name mixed A template name or a TemplateReferenceInterface instance
return boolean true if the template exists, false otherwise
    function exists($name);

Usage Example

 /**
  * 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;
 }
All Usage Examples Of Symfony\Component\Templating\EngineInterface::exists