Skip to content

Commit

Permalink
Merge pull request #218 from creative-commoners/pulls/4/publishing-re…
Browse files Browse the repository at this point in the history
…adme

DOC Automatic publishing of linked pages and files
  • Loading branch information
GuySartorelli authored Feb 13, 2024
2 parents 2bf91ca + 2b0eef1 commit 003ccfb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,28 @@ class MyCustomLink extends Link

Custom links can have validation set using standard [model validation](https://docs.silverstripe.org/en/5/developer_guides/forms/validation/#model-validation).

## Automatic publishing of linked pages and files

When publishing a link that is either a "Page on this site" or a "Link to a file", the page or file that is linked to will not be automatically published when the link is published. This is to prevent unintentional publishing of draft or modified pages and files. However this does mean that content authors may publish links to unpublished pages or files which will return a 404 when a regular user attempts to use the link.

The link is itself published when the link's "owner" is published. The links owner is a page or another `DataObject` that the link has been added to as a relation.

If you wish to have pages and files that are linked to be automatically published when the link is published, then add the following YAML configuration in your project:

```yml
# "Page on this site"
SilverStripe\LinkField\Models\SiteTreeLink:
owns:
- Page

# "Link to a file"
SilverStripe\LinkField\Models\FileLink:
owns:
- File
```
Read more about [defining ownership between related objects](https://docs.silverstripe.org/en/5/developer_guides/model/versioning/#defining-ownership-between-related-versioned-dataobject-models).
## Migration from LinkField v3 to v4
The `Title` DB field has been renamed to `LinkText`
Expand Down

0 comments on commit 003ccfb

Please sign in to comment.