Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,31 @@ In other words, if @CHUNK Hello is the value of a TV called MyChunk, the followi
## Syntax

``` php
@CHUNK chunk_name
@CHUNK chunk_name [properties_as_json]
```

Binds the variable to a chunk. Where chunk\_name is the name of the chunk. The returned value is a string containing the content of the chunk.
Binds the variable to a Chunk. `chunk_name` is the Chunk name. The returned value is the parsed Chunk output.

This binding is very similar to the [@RESOURCE binding](building-sites/elements/template-variables/bindings/resource-binding "RESOURCE Binding") with the exception that it will bind the TV to a [Chunk](building-sites/elements/chunks "Chunks").
Optional JSON properties (MODX 3.0+) are passed to `getChunk()` as the Chunk placeholders / properties array.

## Usage

``` php
@CHUNK MycontactForm
```

With properties:

``` php
@CHUNK MycontactForm {"submitLabel":"Send","showTitle":"1"}
```

Invalid JSON after the Chunk name is logged as an error and ignored; the Chunk still runs without those properties.

This binding is similar to the [@RESOURCE binding](building-sites/elements/template-variables/bindings/resource-binding "RESOURCE Binding"), except it binds the TV to a [Chunk](building-sites/elements/chunks "Chunks"). For running PHP, use [@SNIPPET](building-sites/elements/template-variables/bindings/snippet-binding "SNIPPET Binding") instead.

## See Also

- [Template Variables](building-sites/elements/template-variables "Template Variables")
- [Bindings](building-sites/elements/template-variables/bindings "Bindings")
- [SNIPPET Binding](building-sites/elements/template-variables/bindings/snippet-binding "SNIPPET Binding")
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ These Data Sources can be tied (or "bound") to a Template Variable for formattin

- @FILE file\_path
- @RESOURCE resource\_id
- @CHUNK chunk\_name
- @CHUNK chunk\_name \[properties\_as\_json\]
- @SNIPPET snippet\_name \[properties\_as\_json\]
- @SELECT sql\_query
- @DIRECTORY path\_relative\_to\_base\_path
- @INLINE available in some Extras (e.g. getResources), this specifies a formatting chunk in-line as a string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The @SNIPPET Binding executes the specified MODX snippet. It should be used with
```

Binds the variable to a snippet. Where snippet_name is the name of the snippet. The returned value is the output of the snippet.\
The JSON formatted properties are optional and are passed as scriptProperties to the snippet.
The JSON formatted properties are optional (MODX 3.0+) and are passed as scriptProperties to the snippet.

## Usage

Expand Down
6 changes: 6 additions & 0 deletions en/building-sites/elements/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ After you've created one or more Templates, you can edit any Resource and choose

Templates can contain any tags, including [Template Variables](building-sites/elements/template-variables "Template Variables"), [Chunks](building-sites/elements/chunks "Chunks"), [Snippets](extending-modx/snippets "Snippets"), and others.

### Manager Icon Class

When you create or edit a Template, the **Manager Icon Class** field (`template_icon`) sets a CSS class for Resources that use that Template in the Resource tree. Use Font Awesome-style classes such as `icon-home` or `fa-home`.

If this field is set, it takes precedence over the Content Type Icon for tree display. Leave it empty when you want the [Content Type](building-sites/resources/content-types) Icon (or the default resource / folder icon) to apply instead.

### Using Resource Fields in the Template

As you noticed from our Template sample code above, the fields of a Resource can be referenced using the `[[*fieldName]]` syntax. A list of available Resource Fields can be [found here](building-sites/resources#Resources-ResourceFields). For example, if we wanted to show the current Resource's pagetitle in our `<title>` tag, we would simply do this:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ _old_uri: "2.x/administering-your-site/media-sources/media-source-types/media-so

This Source Type allows you to browse the file system your MODX installation resides on.

In MODX 3 the driver is League Flysystem with a local adapter.

## Available Properties

| Name | Description |
Expand All @@ -21,6 +23,22 @@ This Source Type allows you to browse the file system your MODX installation res
| thumbnailType | When a thumbnail is displayed, the type of image it will be rendered as. **Default Value**: png |
| thumbnailQuality | The quality of the rendered thumbnail, on a scale from 0-100. **Default Value**: 90 |
| skipFiles | A comma-separated list of filenames to skip when browsing the source. **Default Value**: .svn,.git,\_notes,nbproject,.idea,.DS\_Store |
| visibility | Default Flysystem visibility for **new** files and folders: `public` or `private`. **Default**: `public`. Added in MODX 3.0. |

### File and folder visibility (MODX 3.0+)

File System sources support Flysystem visibility for both files and folders (`visibility_files` and `visibility_dirs` are enabled).

- Private objects show an `icon-eye-slash` instead of the normal folder / file icon in the Files tree.
- Right-click a file or folder → **Set Visibility** → choose Public or Private.
- The source `visibility` property is only the default for newly created objects. It does not rewrite existing items.
- Changing visibility requires media-source save access. Folder menu items also need `directory_chmod`. File menu items need `file_update` (the processor still checks `directory_chmod`).

Some remote adapters and certain file types (for example some `.php` paths) may refuse a visibility change. Check the error log if Set Visibility fails.

### Protected system directories (MODX 3.0+)

Browser processors refuse to **rename or remove** directories that resolve to core install paths: assets, base, connectors, core, manager, processors, and the xPDO core path. [#14374](https://github.com/modxcms/revolution/pull/14374) Pointing a File System source at the MODX root does not let you delete or rename those folders from the Files tree. Create sources under `assets/` (or another non-core tree) for day-to-day media work.

## See Also

Expand Down
3 changes: 3 additions & 0 deletions en/building-sites/media-sources/types/media-source-type-s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ This Media Source type connects the Manager to an Amazon S3 bucket (or an S3-com
| thumbnailType | Image format for generated thumbnails. **Default**: `png` |
| thumbnailQuality | Thumbnail quality from 0 to 100. **Default**: `90` |
| skipFiles | Comma-separated names to hide while browsing. **Default**: `.svn,.git,_notes,nbproject,.idea,.DS_Store` |
| visibility | Default Flysystem visibility for **new files**: `public` or `private`. **Default**: `private`. S3 sources support file visibility only (`visibility_dirs` is false), so folder Set Visibility is not offered. |

MODX 3 media sources use League Flysystem (AWS SDK v3 for this type). Custom media source classes should target the Flysystem-based APIs rather than the pre-3.0 filesystem helpers.

## See Also

Expand Down
15 changes: 15 additions & 0 deletions en/building-sites/resources/content-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,26 @@ The fields that appear are as follows:
- **Name** - This is the name of the Content Type. It is mainly for organizational and labeling purposes, and does not affect the function of the type.
- **MIME Type** - Here you can set the MIME Type for the extension, which will tell the browser what type of file the [Resources](building-sites/resources "Resources") is. A list of available MIME Types can be found [here](http://www.iana.org/assignments/media-types/) or [here](http://www.feedforall.com/mime-types.htm).
- **File Extensions** - This is the file extension to render the Resource as. Include the dot, e.g. ".doc"
- **Icon** - Optional CSS class for the Resource tree icon (MODX 3.0+). Examples: `icon-css`, `icon-json`, `icon-pdf`, or a Font Awesome class such as `icon-home` / `fa-home`. Leave empty to fall back to the Template icon or the default resource icon.
- **Binary** - Is the file type text/ascii or binary?
- **Description** - An optional field for your own descriptive purposes.

From there, click "save" and the Content Type will appear in the grid.

### Resource tree icons (MODX 3.0+)

MODX builds tree icons from CSS classes returned by the Resource. Prefer this order when you pick an icon:

1. **Template** Manager Icon Class, if set on the Template.
2. **Content Type** Icon, if set on the Content Type and no Template icon wins visually for your theme.
3. Default `mgr_tree_icon_{classKey}` (for example `tree-resource`), plus weblink / symlink / static-resource icons when those types apply.

Core Content Types ship with useful defaults for non-HTML MIME types (`icon-xml`, `icon-css`, `icon-js`, `icon-json`, `icon-pdf`, and similar). HTML usually keeps an empty Icon so the normal document / folder icon remains.

You can edit Icon inline in the Content Types grid or in the create/update window. Protected system types still allow Icon (and file extensions) to change.

See also [Templates](building-sites/elements/templates) for the Template Manager Icon Class field.

**About Aliases**
When you create resources, the File Extension you choose for your content type will be what's appended to the alias of that resource (if you have friendly URLs enabled)

Expand Down
47 changes: 29 additions & 18 deletions en/building-sites/settings/forgot_login_email.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,39 @@ _old_id: "130"
_old_uri: "2.x/administering-your-site/settings/system-settings/forgot_login_email"
---

## forgot\_login\_email
## Password reset email (MODX 3)

**Name**: Forgot Login Email
**Type**: textarea
**Default**: (see below)
**Available In**: Revolution 2.0.0+
In MODX 3 the manager forgot-password flow no longer emails a temporary password. The user gets a one-time reset link, opens the manager login screen, and chooses a new password. [#13786](https://github.com/modxcms/revolution/pull/13786)

The template for the email that is sent when a user has forgotten their MODX username and/or password.
The email body comes from the lexicon key `login_forgot_email` (namespace `core`, topic `login`), not from a system setting. Edit it under System → Lexicon Management, or override it in a custom lexicon.

The default is:
The default English text is:

``` html
<p>Hello [[+username]],</p>
<p>A request for a password reset has been issued for your MODX user. If you sent this, you may follow this link and use this password to login. If you did not send this request, please ignore this email.</p>
```html
<h2>Forgot your password?</h2>
<p>We received a request to change your MODX Revolution password. You can reset your password by clicking the button below and following the instructions on screen.</p>
<p class="center"><a href="[[+url_scheme]][[+http_host]][[+manager_url]]?modhash=[[+hash]]" class="btn">Reset my password</a></p>
<p class="small">If you did not send this request, please ignore this email.</p>
```

<p>
<strong>Activation Link:</strong> [[+url_scheme]][[+http_host]][[+manager_url]]?modahsh=[[+hash]]<br />
<strong>Username:</strong> [[+username]]<br />
<strong>Password:</strong> [[+password]]<br />
</p>
### Placeholders

<p>After you log into the MODX Manager, you can change your password again, if you wish.</p>
| Placeholder | Role |
| --- | --- |
| `[[+hash]]` | One-time activation hash (required in the reset URL as `modhash`) |
| `[[+url_scheme]]`, `[[+http_host]]`, `[[+manager_url]]` | Build the absolute manager URL |
| `[[+username]]` and other user fields | Available from the user object when the message is parsed |
| System config placeholders | Merged from `$modx->config` before parse |

<p>Regards,<br />Site Administrator</p>
```
Do **not** put `[[+password]]` in the template. MODX 3 does not generate or send a password in this email.

### Reset flow

1. User requests a reset on the manager login screen (`allow_manager_login_forgot_password` must be enabled).
2. MODX stores a hash and emails the lexicon message with `?modhash=[[+hash]]`.
3. Opening that URL loads the login screen in password-change mode.
4. The user enters and confirms a new password.

### Legacy `forgot_login_email` setting

Revolution 2.x used the `forgot_login_email` system setting for this template. That setting is removed in MODX 3. Upgraded sites that still have a customized value in the database should move the HTML into the `login_forgot_email` lexicon entry and drop any `[[+password]]` line.
14 changes: 14 additions & 0 deletions en/building-sites/tag-syntax/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ A good rule-of-thumb is that your tags should fit onto one line, even if you mul
]]
```

## Literal square brackets inside tags

MODX 3 can keep literal single `[` and `]` characters inside tag property values (for example in an output filter) without breaking tag collection. [#13904](https://github.com/modxcms/revolution/pull/13904)

```php
[[+label:notempty=`[required]`]]
```

Standard tags still use double brackets: `[[ ... ]]`.

## Array values in element properties (extras / custom parsers)

When a snippet, chunk, or other element receives **array** property values (typical in PHP API calls rather than tag strings), MODX builds a stable cache/tag signature by serializing those arrays. Custom parser or element subclasses that forge tag signatures should treat array properties the same way so cache keys stay sortable and consistent. [#14689](https://github.com/modxcms/revolution/pull/14689)

## Properties

All MODX tags can accept [properties](building-sites/properties-and-property-sets), not just Snippets.
Expand Down
24 changes: 24 additions & 0 deletions en/building-sites/tag-syntax/output-filters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,30 @@ The following table lists some of the existing modifiers and shows examples of t
| urldecode | Converts the input from an URL-friendly string Similar to PHP's [urldecode](http://www.php.net/manual/en/function.urldecode.php) | `[[+myparam:urldecode]]` |
| filterPathSegment | Added in 2.7. Converts the input into a URL-friendly string with the same mechanism that turns a pagetitle into an alias, including transliteration if enabled. Useful for custom urls. | `[[+pagetitle:filterPathSegment]]` |

### File path output modifiers

Added in MODX 3.0. These modifiers wrap PHP [`pathinfo()`](https://www.php.net/manual/en/function.pathinfo.php). They do not check whether the path exists on disk. Options after the modifier are ignored.

| Modifier | Description | Example |
| ---------- | ----------- | ------- |
| dirname | Directory portion of the path | `[[+filepath:dirname]]` → `/assets/images` for `/assets/images/logo.jpg` |
| basename | File name including extension | `[[+filepath:basename]]` → `logo.jpg` |
| filename | File name without the final extension | `[[+filepath:filename]]` → `logo` |
| extension | Final extension only (singular name; not `extensions`) | `[[+filepath:extension]]` → `jpg` |

Edge cases worth knowing:

- `test.inc.php` → filename `test.inc`, extension `php`
- `file.tar.gz` → filename `file.tar`, extension `gz`
- `.htaccess` → empty filename, extension `htaccess`
- A path with no extension returns an empty extension string

```php
[[*myImageTV:basename]]
[[*myImageTV:dirname]]/thumbs/[[*myImageTV:filename]].webp
[[+file:extension:lcase:is=`pdf`:then=`PDF`:else=`Other`]]
```

### Caching

In general, any content in a placeholder that you think **might change dynamically** should be uncached. For example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,17 @@ var userId = MODx.user.id;

### MODx.perm

This will contain the following permissions should they be granted to the user (they will not exist if the user does not have the permission):

| Name | Description |
| --------------------------- | --------------------------------------------------- |
| MODx.perm.resource\_tree | To view the Resources tree. |
| MODx.perm.element\_tree | To view the Elements tree. |
| MODx.perm.file\_tree | To view the Files tree. |
| MODx.perm.file\_upload | To be able to upload files. |
| MODx.perm.file\_manager | To use the MODX file browser. |
| MODx.perm.new\_chunk | To create a new Chunk. |
| MODx.perm.new\_plugin | To create a new Plugin. |
| MODx.perm.new\_snippet | To create a new Snippet. |
| MODx.perm.new\_template | To create a new Template. |
| MODx.perm.new\_tv | To create a new Template Variable. |
| MODx.perm.directory\_create | To be able to create a directory on the filesystem. |
`MODx.perm` is a map of **every** manager permission name to a boolean for the current user. Config JS loads distinct rows from `modAccessPermission` and sets each key with `hasPermission()`. There is no fixed subset. [#13924](https://github.com/modxcms/revolution/pull/13924), [#14425](https://github.com/modxcms/revolution/pull/14425)

``` javascript
Use any permission key your Extra or CMP checks, for example:

```javascript
if (MODx.perm.file_upload) { /* ...code... */ }
if (MODx.perm.view_document) { /* ... */ }
```

Common keys still include `resource_tree`, `element_tree`, `file_tree`, `file_upload`, `file_manager`, `new_chunk`, `new_plugin`, `new_snippet`, `new_template`, `new_tv`, and `directory_create`. Missing keys mean the user does not have that permission (treat as falsy).

## Custom Methods

The MODx object also has quite a few custom methods available to it:
Expand Down
Loading
Loading