-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial updates to docs Make chunks work with name Make default_element work with UUID * Initial updates to docs Synchronize Element / TV setting options * working on toggle group for element settings * adding screenshots to the "Options" doc
- Loading branch information
Showing
27 changed files
with
3,238 additions
and
1,210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# Documentation | ||
- [ ] Include documentation on Template Variables | ||
- [x] Include documentation on Template Variables | ||
- [ ] Add screenshots to different Option Types | ||
- [ ] Document **chunk** Element option | ||
- [ ] New resource variable placeholders | ||
- [x] Document **chunk** Element option | ||
- [x] New resource variable placeholders | ||
- [ ] Reference GPM in collaborative theme development | ||
|
||
# Programming | ||
- [ ] Make **chunk** option work without ID | ||
- [ ] Make theme's **Default Element** work without ID | ||
- [x] Make **chunk** option work without ID | ||
- [x] Make theme's **Default Element** work without ID | ||
- [ ] Add **Theme Options** using the theme's namespace in system settings | ||
- Allow values to be context specific or global | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Template Variables in Fred | ||
|
||
Fred allows you to expose Template Variables (TVs) to the user. When used in an Element, Fred will update the display when the variable changes. This allows you to create dynamic content that can be updated by the user. | ||
|
||
## Creating Template Variables | ||
|
||
You start by creating a TV the same way you would normally in MODX. You need to assign the TV to one or more of the Templates assigned in your Fred Theme. | ||
|
||
### Configure Properties | ||
|
||
To display a TV on the frontend, you will need to configure the variables properties. This works similar to Fred Options. You will go to the Properties tab on the TV and unlock the default properties. | ||
|
||
![tv_properties.png](tv_properties.png) | ||
|
||
At minimum, you will need to add the `fred` property. This will be the type "Yes/No" and the default value should be set to `Yes`. | ||
|
||
TVs can have all the types that Fred Options have. You can find more information on the different types in the [Fred Options documentation](settings.md#available-settings-types). | ||
|
||
To set a type just add the property `fred.type` with the value of the type you want to use. For example, to set a TV to an image input you would add the property `fred.type` with the value of `image`. | ||
|
||
To set type-specific properties, you would add them with the prefix `fred.`. For example, to set the image TV to use a specific Media Source you would add the property `fred.mediaSource` with the value of the Media Source name. | ||
|
||
## Using Template Variables in Elements | ||
|
||
Once you have created a TV and assigned it to a Template, you can use it in an Element. You can reference the TV in the Element's settings by using the TV name as a Twig variable prefixed by `tv_`. For example, if you have a TV named `myTV`, you would reference it in the Element settings as `{{ tv_myTV }}`. | ||
|
||
When you drag the Element onto a page, Fred will replace the Twig variable with the value of the TV. If the TV is an image, Fred will render the image. If the TV is a text input, Fred will render the text. | ||
|
||
Additionally, you can use `data-fred-target` to allow the TV to be editable within an element. For example, in the case of the above image TV, you could have an element like: | ||
|
||
```Twig | ||
<img | ||
src="{{ tv_myTV }}" | ||
data-fred-target="tv_myTV" | ||
data-fred-name="my-tv" | ||
data-fred-media-source="Assets" | ||
alt="{{ pagetitle }} Logo" | ||
/> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.