Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Developer Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
brienne
Developer Documentation
Commits
bd073626
Commit
bd073626
authored
7 years ago
by
totten
Browse files
Options
Downloads
Patches
Plain Diff
asset-builder.md - In first example, distinguish CLI+PHP
parent
c5bcd3cb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/framework/asset-builder.md
+10
-3
10 additions, 3 deletions
docs/framework/asset-builder.md
with
10 additions
and
3 deletions
docs/framework/asset-builder.md
+
10
−
3
View file @
bd073626
...
...
@@ -55,16 +55,23 @@ function mymodule_civicrm_buildAsset($asset, $params, &$mimeType, &$content) {
}
```
Check it is functioning correctly with:
To quickly test if the asset is defined correctly, run this on the command-line:
```
$ cv ev '$x = \Civi::service("asset_builder")->render("api-fields.json"); echo $x["content"];'
```
Get the generated URL:
Or run this command to obtain the asset's URL:
```
$ cv ev 'return \Civi::service("asset_builder")->getU
RL
("api-fields.json");'
$ cv ev 'return \Civi::service("asset_builder")->getU
rl
("api-fields.json");'
```
Notice that these commands use
`Civi::service("asset_builder")`
and the
functions
`render(...)`
or
`getUrl(...)`
to manage the asset. You can call
these functions in your PHP code. Further down, the fully formed CSS
example will demonstrate this.
!!! note "What does
`getUrl(...)`
do?"
In normal/production mode, `getUrl(...)` checks to see if the asset
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment