mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Deprecate SS_TemplateManifest
This commit is contained in:
parent
e4935123d8
commit
5d6b7c85d7
@ -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`,
|
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
|
`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
|
`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)
|
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 template names, paths and other meta data for each template
|
instance. This is a serialized object containing a map of [ThemeManifest](api:SilverStripe\View\ThemeManifest) instances. For SilverStripe to find the `GenericEmail` 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 manifests. The manifests are created and added to the loader when the
|
||||||
it does not check all your `template` folders on the fly, it simply asks the `manifest`.
|
[kernel](api:SilverStripe\Core\CoreKernel) is instantiated.
|
||||||
|
|
||||||
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>
|
|
||||||
|
|
||||||
## Template Priority
|
## Template Priority
|
||||||
|
|
||||||
|
@ -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.
|
To override the `$dependency` declaration for a class, define the following configuration file.
|
||||||
|
|
||||||
**mysite/_config/app.yml**
|
**mysite/_config/app.yml**
|
||||||
|
```yml
|
||||||
MyController:
|
MyController:
|
||||||
dependencies:
|
dependencies:
|
||||||
textProperty: a string value
|
textProperty: a string value
|
||||||
permissions: %$PermissionService
|
permissions: %$PermissionService
|
||||||
|
```
|
||||||
## Managed objects
|
## Managed objects
|
||||||
|
|
||||||
Simple dependencies can be specified by the `$dependencies`, but more complex configurations are possible by specifying
|
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
|
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.
|
assign a reference to that service.
|
||||||
```yaml
|
|
||||||
|
|
||||||
|
```yaml
|
||||||
Injector:
|
Injector:
|
||||||
JSONServiceDefinition:
|
JSONServiceDefinition:
|
||||||
class: JSONServiceImplementor
|
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:
|
For example with this config:
|
||||||
|
|
||||||
:::yaml
|
```yml
|
||||||
Injector:
|
Injector:
|
||||||
Connector:
|
Connector:
|
||||||
properties:
|
properties:
|
||||||
AsString: true
|
AsString: true
|
||||||
ServiceConnector: %$Connector
|
ServiceConnector: %$Connector
|
||||||
|
```
|
||||||
|
|
||||||
Both `Connector` and `ServiceConnector` will have the `AsString` property set to true, but the resulting
|
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.
|
instances will be classes which match their respective service names, due to the lack of a `class` specification.
|
||||||
|
@ -9,7 +9,6 @@ By default, the storage mechanism chooses the most performant adapter available
|
|||||||
The most common caches are manifests of various resources:
|
The most common caches are manifests of various resources:
|
||||||
|
|
||||||
* PHP class locations ([ClassManifest](api:SilverStripe\Core\Manifest\ClassManifest))
|
* 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))
|
* Configuration settings from YAML files ([ConfigManifest](api:ConfigManifest))
|
||||||
* Language files ([i18n](api:SilverStripe\i18n\i18n))
|
* Language files ([i18n](api:SilverStripe\i18n\i18n))
|
||||||
|
|
||||||
|
@ -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
|
By default, the finder implementation will exclude any classes stored in files within
|
||||||
a `tests/` folder, unless tests are executed.
|
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.
|
in both modules and themes. Templates in `tests/` folders are automatically excluded.
|
||||||
The chapter on [template inheritance](../templates/template_inheritance) provides more details
|
The chapter on [template inheritance](../templates/template_inheritance) provides more details
|
||||||
on its operation.
|
on its operation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user