Deprecate SS_TemplateManifest

This commit is contained in:
Aaron Carlino 2017-08-07 14:51:27 +12:00
parent e4935123d8
commit 5d6b7c85d7
4 changed files with 13 additions and 24 deletions

View File

@ -30,24 +30,14 @@ As we've added a new file, make sure you flush your SilverStripe cache by visiti
Template inheritance works on more than email templates. All files within the `templates` directory including `includes`,
`layout` or anything else from core (or add-on's) template directory can be overridden by being located inside your
`mysite/templates` directory. SilverStripe keeps an eye on what templates have been overridden and the location of the
correct template through a [SS_TemplateManifest](api:SS_TemplateManifest).
correct template through a [ThemeResourceLoader](api:SilverStripe\View\ThemeResourceLoader).
## Template Manifest
## ThemeResourceLoader
The location of each template and the hierarchy of what template to use is stored within a [SS_TemplateManifest](api:SS_TemplateManifest)
instance. This is a serialized object containing a map of template names, paths and other meta data for each template
and is cached in your applications `TEMP_FOLDER` for performance. For SilverStripe to find the `GenericEmail` template
it does not check all your `template` folders on the fly, it simply asks the `manifest`.
The manifest is created whenever you flush your SilverStripe cache by appending `?flush=1` to any SilverStripe URL. For
example by visiting `http://yoursite.com/?flush=1`. When your include the `flush=1` flag, the manifest class will search
your entire project for the appropriate `.ss` files located in `template` directory and save that information for later.
<div class="warning">
Whenever you add or remove template files, rebuild the manifest by visiting `http://yoursite.com/?flush=1`. You can
flush the cache from any page, (.com/home?flush=1, .com/admin?flush=1, etc.). Flushing the cache can be slow, so you
only need to do it when you're developing new templates.
</div>
The location of each template and the hierarchy of what template to use is stored within a [ThemeResourceLoader](api:SilverStripe\View\ThemeResourceLoader)
instance. This is a serialized object containing a map of [ThemeManifest](api:SilverStripe\View\ThemeManifest) instances. For SilverStripe to find the `GenericEmail` template
it does not check all your `template` folders on the fly, it simply asks the manifests. The manifests are created and added to the loader when the
[kernel](api:SilverStripe\Core\CoreKernel) is instantiated.
## Template Priority

View File

@ -197,12 +197,12 @@ An example using the `MyFactory` service to create instances of the `MyService`
To override the `$dependency` declaration for a class, define the following configuration file.
**mysite/_config/app.yml**
```yml
MyController:
dependencies:
textProperty: a string value
permissions: %$PermissionService
```
## Managed objects
Simple dependencies can be specified by the `$dependencies`, but more complex configurations are possible by specifying
@ -281,8 +281,8 @@ named services, which may not be actual classes, and thus should not behave as t
Thus if you want an object to have the injected dependencies of a service of another name, you must
assign a reference to that service.
```yaml
```yaml
Injector:
JSONServiceDefinition:
class: JSONServiceImplementor
@ -299,13 +299,13 @@ If class is not specified, then the class will be inherited from the outer servi
For example with this config:
:::yaml
```yml
Injector:
Connector:
properties:
AsString: true
ServiceConnector: %$Connector
```
Both `Connector` and `ServiceConnector` will have the `AsString` property set to true, but the resulting
instances will be classes which match their respective service names, due to the lack of a `class` specification.

View File

@ -9,7 +9,6 @@ By default, the storage mechanism chooses the most performant adapter available
The most common caches are manifests of various resources:
* PHP class locations ([ClassManifest](api:SilverStripe\Core\Manifest\ClassManifest))
* Template file locations and compiled templates ([SS_TemplateManifest](api:SS_TemplateManifest))
* Configuration settings from YAML files ([ConfigManifest](api:ConfigManifest))
* Language files ([i18n](api:SilverStripe\i18n\i18n))

View File

@ -53,9 +53,9 @@ excluded from manifests by creating a blank `_manifest_exclude` file in the modu
By default, the finder implementation will exclude any classes stored in files within
a `tests/` folder, unless tests are executed.
## Template Manifest
## Theme Manifests
The [SS_TemplateManifest](api:SS_TemplateManifest) class builds a manifest of all templates present in a directory,
The [ThemeManifest](api:SilverStripe\View\ThemeManifest) class builds a manifest of all templates present in a directory,
in both modules and themes. Templates in `tests/` folders are automatically excluded.
The chapter on [template inheritance](../templates/template_inheritance) provides more details
on its operation.