Introduce a CmsObject interface
This will be useful to decouple ComponentPartial and Asset objects from their Halcyon counterparts An Asset is technically not a template, it may be hosted via a CDN or others A ComponentPartial is also different, it is read only and doesn't require caching
This commit is contained in:
parent
a6b007e55c
commit
d65bc5c2ad
|
|
@ -0,0 +1,39 @@
|
|||
<?php namespace Cms\Contracts;
|
||||
|
||||
interface CmsObject
|
||||
{
|
||||
|
||||
/**
|
||||
* Loads the template.
|
||||
*
|
||||
* @param string $hostObj
|
||||
* @param string $fileName
|
||||
* @return mixed
|
||||
*/
|
||||
public static function load($hostObj, $fileName);
|
||||
|
||||
/**
|
||||
* Loads and caches the template.
|
||||
*
|
||||
* @param string $hostObj
|
||||
* @param string $fileName
|
||||
* @return mixed
|
||||
*/
|
||||
public static function loadCached($hostObj, $fileName);
|
||||
|
||||
/**
|
||||
* Returns the local file path to the template.
|
||||
*
|
||||
* @param string $fileName
|
||||
* @return string
|
||||
*/
|
||||
// public static function getFilePath($fileName = null);
|
||||
|
||||
/**
|
||||
* Returns the Twig content string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTwigContent();
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use Event;
|
||||
use Twig_LoaderInterface;
|
||||
use Cms\Classes\CmsObject;
|
||||
use Cms\Contracts\CmsObject;
|
||||
|
||||
/**
|
||||
* This class implements a Twig template loader for the CMS.
|
||||
|
|
@ -19,7 +19,7 @@ class Loader implements Twig_LoaderInterface
|
|||
|
||||
/**
|
||||
* Sets a CMS object to load the template from.
|
||||
* @param \Cms\Classes\CmsObject $obj Specifies the CMS object.
|
||||
* @param \Cms\Contracts\CmsObject $obj Specifies the CMS object.
|
||||
*/
|
||||
public function setObject(CmsObject $obj)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue