Skip to content
Merged
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
@@ -1,12 +1,12 @@
# how To Become GDPR compliant using cookiebot
# How To Become GDPR Compliant Using Cookiebot

We can integrate with a cookie consent banner service such as CookieBot and [depending on the choice of the user we can enable or disable certain parts of uMarketingSuite](../../../../the-umarketingsuite-broad-overview/the-umarketingsuite-cookie/module-permissions/).
You can integrate with a cookie consent banner service such as CookieBot and [depending on the users choice you can configure certain parts of uMS](../../../../the-umarketingsuite-broad-overview/the-umarketingsuite-cookie/module-permissions/).

This has been covered in our documentation previously, but this tutorial gives you a full working implementation to use with [CookieBot](https://www.cookiebot.com/) in particular.

![]()

#### Code Example
## Code Example

The code example below shows how to create the back-end code to read the CookieBot consent cookie from the end-user, and based on that decides which features of uMarketingSuite it should enable or disable.

Expand Down
68 changes: 39 additions & 29 deletions 14/umbraco-forms/developer/rendering-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,42 @@ description: Learn the different ways of rendering a form on your website when u

# Rendering Forms

There are three options available for rendering a form.
There are two options available for rendering a form.

## Rendering Using a View Component

To display a form in your view, you can make a call to a view component:
To display a form in your view, you can make a call to a view component. You can use a forms GUID directly or add a form dynamically by referencing a form selected via a Forms Picker.

```cshtml
@await Component.InvokeAsync("RenderForm", new { formId = Guid.Parse("<form guid>"), theme = "default", includeScripts = false })
When selecting a theme, it can be added directly as a string or dynamically by referencing a theme picked via a Theme Picker.

{% tabs %}

{% tab title="Dynamic" %}

```csharp
@await Component.InvokeAsync("RenderForm", new { formId = @Model.Form,
theme = @Model.Theme,
includeScripts = false })
```

This example uses a Forms Picker with `form` as alias, and a Theme Picker with `theme` as alias.

{% endtab %}

{% tab title="Static" %}

```csharp
@await Component.InvokeAsync("RenderForm", new { formId = Guid.Parse("<form guid>"),
theme = "default",
includeScripts = false })
```

This example hard-codes the GUID of a form and the name of the theme.

{% endtab %}

{% endtabs %}

Six parameters can be provided:

- `formId` is the GUID of a form.
Expand All @@ -23,13 +49,17 @@ Six parameters can be provided:
- `redirectToPageId` is an optional GUID for a content page that, if provided, is redirected to once the form has been submitted. It will be used in preference to post-submission behavior defined on the form itself.
- `additionalData` is an optional dictionary of string values. When provided it will be used as a source for ["magic string" replacements](./magic-strings.md). The data will be associated with the created record and made available for custom logic or update within workflows.

Usually, rather than hard-coding the form's GUID and other details, you'll use a form, theme or content picker on your page:
The following example shows how the `additionalData` parameter is used:

{% code wrap="true" %}

```csharp
var additionalData = new Dictionary<string, string> { { "foo", "bar" }, { "buzz", "baz" } };
@await Component.InvokeAsync("RenderForm", new { formId = @Model.Form, theme = @Model.Theme, includeScripts = false, additionalData })
```

{% endcode %}

## Rendering Using a Tag Helper

If you prefer a tag helper syntax, you can use one that ships with Umbraco Forms.
Expand All @@ -46,29 +76,9 @@ Then in your view you can use:
@if (Model.Form.HasValue)
{
var additionalData = new Dictionary<string, string> { { "foo", "bar" }, { "buzz", "baz" } };
<umb-forms-render form-id="@Model.FormId.Value" theme="@Model.FormTheme" exclude-scripts="true" additional-data="@additionalData" />
<umb-forms-render form-id="@Model.FormId.Value"
theme="@Model.FormTheme"
exclude-scripts="true"
additional-data="@additionalData" />
}
```

## Rendering Using a Macro

With a grid or Rich Text Editor, you need to use a macro. This is also available as an option to display a form in your view, where you provide three parameters:

```cshtml
@await Umbraco.RenderMacroAsync("renderUmbracoForm", new { FormGuid = "<form guid>", FormTheme = "default", ExcludeScripts = "1" })
```

- `FormGuid` is the GUID of a form.
- `FormTheme` is the name of a theme. If not provided, the default theme is used.
- `ExcludeScripts` takes a value of 0 or 1, indicating whether scripts should be excluded from rendering.
- `RedirectToPageId` is an optional picked content item that, if provided, is redirected to once the form has been submitted. It will be used in preference to post-submission behavior defined on the form itself.


Similarly, you can reference a form picker property on your page:

```cshtml
@if (Model.FormId is Guid formId)
{
@await Umbraco.RenderMacroAsync("renderUmbracoForm", new { FormGuid = formId, FormTheme = Model.FormTheme, ExcludeScripts = "1" })
}
```
12 changes: 2 additions & 10 deletions 14/umbraco-forms/developer/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,9 @@ If adding or amending client-side scripts, you need to copy the `Script.cshtml`

## Using a Theme

To use a theme with a Form use the "Insert Form" macro where you will be presented with the options of the form you wish to insert along with an option to pick a theme. This displays the list of theme folders found at `Views/Partials/Forms/Themes`.
When rendering a form in a view file, you can specify which theme to use with the form.

![Choosing and using a theme](../../../10/umbraco-forms/developer/images/select-a-theme.png)

When you are rendering your form directly in your template, you need to specify your theme by filling out the `FormTheme` attribute:

```csharp
@await Umbraco.RenderMacroAsync("renderUmbracoForm", new {FormGuid="1ec026cb-d4d3-496c-b8e8-90e0758c78d8", FormTheme="MyFormTheme", ExcludeScripts="0"})
```

If you do not pick and/or set a theme, the `default` theme will be used to render the form.
Learn more about how to render a form with a theme in the [Rendering Forms](./rendering-forms.md) article.

## Theme Fallbacks

Expand Down
Loading