Skip to content

Commit 005a1db

Browse files
authored
Merge pull request #7446 from greystate/issue-7220-upload-field
Update documentation and codesamples for upload field, multiurl picker and richtext mce
2 parents 99925f4 + 69ae969 commit 005a1db

File tree

16 files changed

+117
-95
lines changed

16 files changed

+117
-95
lines changed

15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/file-upload.md

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,42 +33,36 @@ Example: `"/media/o01axaqu/guidelines-on-remote-working.pdf"`
3333
### Without Models Builder
3434

3535
```csharp
36-
@using System.IO;
37-
@{
38-
if (Model.HasValue("myFile"))
39-
{
40-
var myFile = Model.Value<string>("myFile");
41-
42-
<a href="@myFile">@System.IO.Path.GetFileName(myFile)</a>
43-
}
36+
@if (Model.HasValue("myFile"))
37+
{
38+
var myFile = Model.Value<string>("myFile");
4439

40+
<a href="@myFile">@System.IO.Path.GetFileName(myFile)</a>
4541
}
4642
```
4743

4844
### With Models Builder
4945

5046
```csharp
51-
@if (!Model.HasValue(Model.MyFile))
47+
@if (Model.HasValue("MyFile"))
5248
{
5349
<a href="@Model.MyFile">@System.IO.Path.GetFileName(Model.MyFile)</a>
5450
}
5551
```
5652

5753
## Add values programmatically
5854

59-
{% hint style="info" %}
60-
The samples in this section have not been verified against the latest version of Umbraco.
61-
62-
Instead, we recommend using the [Media Picker](media-picker-3.md) for uploading files to your Umbraco website.
63-
{% endhint %}
64-
6555
See the example below to see how a value can be added or changed programmatically. To update a value of this property editor you need the [Content Service](https://apidocs.umbraco.com/v15/csharp/api/Umbraco.Cms.Core.Services.ContentService.html) and the [Media Service](https://apidocs.umbraco.com/v15/csharp/api/Umbraco.Cms.Core.Services.MediaService.html).
6656

6757
{% hint style="info" %}
6858
The example below demonstrates how to add values programmatically using a Razor view. However, this is used for illustrative purposes only and is not the recommended method for production environments.
6959
{% endhint %}
7060

7161
```csharp
62+
@using System.Net
63+
@using Umbraco.Cms.Core
64+
@using Umbraco.Cms.Core.Services
65+
@using Umbraco.Cms.Core.PropertyEditors
7266
@using Umbraco.Cms.Core.IO
7367
@using Umbraco.Cms.Core.Serialization
7468
@using Umbraco.Cms.Core.Strings
@@ -115,22 +109,13 @@ The example below demonstrates how to add values programmatically using a Razor
115109
}
116110
```
117111

118-
Although the use of a GUID is preferable, you can also use the numeric ID to get the page:
119-
120-
```csharp
121-
@{
122-
// Get the page using it's id
123-
var content = ContentService.GetById(1234);
124-
}
125-
```
126-
127112
If Models Builder is enabled you can get the alias of the desired property without using a magic string:
128113

129114
```csharp
130115
@using Umbraco.Cms.Core.PublishedCache
131116
@inject IPublishedContentTypeCache PublishedContentTypeCache
132117
@{
133-
// Set the value of the property with alias 'myFile'
134-
content.SetValue(Home.GetModelPropertyType(PublishedContentTypeCache, x => x.MyFile).Alias, publishedMedia.Url();
118+
// Set the value of the property `MyFile` by looking up its alias
119+
content.SetValue(Home.GetModelPropertyType(PublishedContentTypeCache, x => x.MyFile).Alias, publishedMedia.Url());
135120
}
136121
```
48.4 KB
Loading
9.68 KB
Loading

15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/multi-url-picker.md

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,27 @@
66

77
`Returns: IEnumerable<Link> or Link`
88

9-
Multi Url Picker allows an editor to pick and sort multiple urls. This property editor returns a single item if the "Maximum number of items" Data Type setting is set to 1 or a collection if it is 0. These can either be internal, external or media.
9+
Multi Url Picker allows an editor to pick and sort multiple URLs.
10+
It returns either a single item or a collection. This depends on the "Maximum number of items" Data Type setting.
11+
When that is set to 1, it returns a single item, otherwise a collection.
12+
Multi URL Picker allows editors to select and sort multiple URLs. The property returns either a single item or a collection, depending on the **Maximum number of items** setting in the Data Type configuration.
13+
14+
- When the maximum is set to 1, it returns a single item.
15+
- When the maximum is greater than 1, it returns a collection.
16+
17+
The URLs can point to **internal**, **external**, or **media** items.
1018

1119
## Data Type Definition Example
1220

13-
![Related Links Data Type Definition](images/Multi-Url-Picker-DataType.png)
21+
![Multi URL Picker Data Type Definition](images/Multi-Url-Picker-DataType.png)
1422

1523
## Content Example
1624

17-
![Media Picker Content](../../../../../../10/umbraco-cms/fundamentals/backoffice/property-editors/built-in-property-editors/images/Multy-Url-Picker-Content-v8.png)
25+
![Multi Url Picker Content](images/Multi-Url-Picker-Content.png)
1826

19-
## MVC View Example - value converters enabled
27+
## MVC View Example
2028

21-
## Typed
29+
### Without Models Builder
2230

2331
```csharp
2432
@using Umbraco.Cms.Core.Models
@@ -36,7 +44,7 @@ Multi Url Picker allows an editor to pick and sort multiple urls. This property
3644
}
3745
```
3846

39-
If `Max number of items` is configured to `1`
47+
This example handles the case of `Maximum number of items` set to `1`:
4048

4149
```csharp
4250
@using Umbraco.Cms.Core.Models
@@ -49,6 +57,36 @@ If `Max number of items` is configured to `1`
4957
}
5058
```
5159

60+
### With Models Builder
61+
62+
```csharp
63+
@{
64+
var links = Model.FooterLinks;
65+
if (links.Any())
66+
{
67+
<ul>
68+
@foreach (var link in links)
69+
{
70+
<li><a href="@link.Url" target="@link.Target">@link.Name</a></li>
71+
}
72+
</ul>
73+
}
74+
}
75+
```
76+
77+
And here is the case of `Maximum number of items` set to `1`:
78+
79+
```csharp
80+
@{
81+
var link = Model.Link;
82+
if (link != null)
83+
{
84+
<a href="@link.Url" target="@link.Target">@link.Name</a>
85+
}
86+
}
87+
```
88+
89+
5290
## Add values programmatically
5391

5492
See the example below to see how a value can be added or changed programmatically. To update a value of a property editor you need the [Content Service](https://apidocs.umbraco.com/v15/csharp/api/Umbraco.Cms.Core.Services.ContentService.html).
@@ -126,15 +164,6 @@ The example below demonstrates how to add values programmatically using a Razor
126164
}
127165
```
128166

129-
Although the use of a GUID is preferable, you can also use the numeric ID to get the page:
130-
131-
```csharp
132-
@{
133-
// Get the page using it's id
134-
var content = ContentService.GetById(1234);
135-
}
136-
```
137-
138167
If Models Builder is enabled you can get the alias of the desired property without using a magic string:
139168

140169
```csharp

15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor-tinymce/README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
`Returns: HTML`
88

99
{% hint style="warning" %}
10-
This article is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice.
10+
In Umbraco 15, the Rich Text Editor has a new default property editor UI that introduces Tiptap as an alternative.
11+
12+
You can continue to use the TinyMCE UI for the Rich Text Editor, but this UI will be removed in Umbraco 16.
1113
{% endhint %}
1214

1315
The Rich Text Editor (RTE) is highly configurable and based on [TinyMCE](https://www.tinymce.com/). Depending on the configuration, it will give your content editors more flexibility when working with content that should be more than plain text.
1416

1517
{% hint style="info" %}
1618
**Are you using custom configurations or plugins with TinyMCE?**
1719

18-
In Umbraco 11 the TinyMCE version supported has been upgraded from version 4 to version 6. You need to migrate to the latest version if you are using TinyMCE plugins or custom configuration.
20+
In Umbraco 11 the TinyMCE version supported was upgraded from version 4 to version 6. You need to migrate to the latest version if you are using TinyMCE plugins or custom configuration.
1921

2022
If your site is upgraded from an older version, follow the migration guides below to upgrade the TinyMCE version as well.
2123

@@ -25,7 +27,7 @@ If your site is upgraded from an older version, follow the migration guides belo
2527

2628
## [Configuration options](configuration.md)
2729

28-
Customize everything from toolbar options to editor size to where pasted images are saved.
30+
Customize everything from toolbar options and editor size to where pasted images are saved.
2931

3032
## [Styles](styles.md)
3133

@@ -41,11 +43,11 @@ Extend the functionality of the Rich Text Editor with plugins.
4143

4244
## Data Type Definition Example
4345

44-
![Rich Text Editor - Data Type](images/rte-datatype-v10.png)
46+
![Rich Text Editor - Data Type](images/rte-datatype-v15.png)
4547

4648
## Content Example
4749

48-
![Rich Text Editor - Content](images/rte-content-11.png)
50+
![Rich Text Editor - Content](images/rte-content-v15.png)
4951

5052
## MVC View Example
5153

@@ -99,15 +101,6 @@ The example below demonstrates how to add values programmatically using a Razor
99101
}
100102
```
101103

102-
Although the use of a GUID is preferable, you can also use the numeric ID to get the page:
103-
104-
```csharp
105-
@{
106-
// Get the page using it's id
107-
var content = ContentService.GetById(1234);
108-
}
109-
```
110-
111104
If Models Builder is enabled you can get the alias of the desired property without using a magic string.
112105

113106
```csharp
Loading
Loading

16/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/file-upload.md

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Find the full documentation for the property in the [Media Picker](media-picker-
2222

2323
## Content Example
2424

25-
![Content Example Empty](../../../../../../10/umbraco-cms/fundamentals/backoffice/property-editors/built-in-property-editors/images/content-example-empty.png) ![Content Example](../../../../../../10/umbraco-cms/fundamentals/backoffice/property-editors/built-in-property-editors/images/File-Upload-content-example.png)
25+
![Content Example Empty](images/fileupload-content-empty.png) ![Content Example](images/fileupload-content.png)
2626

2727
In code, the property is a string, which references the location of the file.
2828

@@ -33,42 +33,36 @@ Example: `"/media/o01axaqu/guidelines-on-remote-working.pdf"`
3333
### Without Models Builder
3434

3535
```csharp
36-
@using System.IO;
37-
@{
38-
if (Model.HasValue("myFile"))
39-
{
40-
var myFile = Model.Value<string>("myFile");
41-
42-
<a href="@myFile">@System.IO.Path.GetFileName(myFile)</a>
43-
}
36+
@if (Model.HasValue("myFile"))
37+
{
38+
var myFile = Model.Value<string>("myFile");
4439

40+
<a href="@myFile">@System.IO.Path.GetFileName(myFile)</a>
4541
}
4642
```
4743

4844
### With Models Builder
4945

5046
```csharp
51-
@if (!Model.HasValue(Model.MyFile))
47+
@if (Model.HasValue("myFile"))
5248
{
5349
<a href="@Model.MyFile">@System.IO.Path.GetFileName(Model.MyFile)</a>
5450
}
5551
```
5652

5753
## Add values programmatically
5854

59-
{% hint style="info" %}
60-
The samples in this section have not been verified against the latest version of Umbraco.
61-
62-
Instead, we recommend using the [Media Picker](media-picker-3.md) for uploading files to your Umbraco website.
63-
{% endhint %}
64-
6555
See the example below to see how a value can be added or changed programmatically. To update a value of this property editor you need the [Content Service](https://apidocs.umbraco.com/v15/csharp/api/Umbraco.Cms.Core.Services.ContentService.html) and the [Media Service](https://apidocs.umbraco.com/v15/csharp/api/Umbraco.Cms.Core.Services.MediaService.html).
6656

6757
{% hint style="info" %}
6858
The example below demonstrates how to add values programmatically using a Razor view. However, this is used for illustrative purposes only and is not the recommended method for production environments.
6959
{% endhint %}
7060

7161
```csharp
62+
@using System.Net
63+
@using Umbraco.Cms.Core
64+
@using Umbraco.Cms.Core.Services
65+
@using Umbraco.Cms.Core.PropertyEditors
7266
@using Umbraco.Cms.Core.IO
7367
@using Umbraco.Cms.Core.Serialization
7468
@using Umbraco.Cms.Core.Strings
@@ -115,15 +109,6 @@ The example below demonstrates how to add values programmatically using a Razor
115109
}
116110
```
117111

118-
Although the use of a GUID is preferable, you can also use the numeric ID to get the page:
119-
120-
```csharp
121-
@{
122-
// Get the page using it's id
123-
var content = ContentService.GetById(1234);
124-
}
125-
```
126-
127112
If Models Builder is enabled you can get the alias of the desired property without using a magic string:
128113

129114
```csharp

0 commit comments

Comments
 (0)