Snippet Call

Last modified: August 20, 2024

Introduction

The Snippet call widget allows you to use a snippet on a page, a layout, or another snippet:

Snippet Call Example

Properties Pane

The properties pane is divided into two major sections by a toggle at the top of the pane: Properties and Styling. Snippet call properties consist of the following sections:

Properties:

Styling:

Properties

General Section

Snippet

The Snippet property shows the name of the snippet that the snippet call will display.

Snippet Settings

The Snippet settings property opens a dialog box that shows a list of parameters of the selected snippet and the objects that will be passed to each of them.

Common Section

For more information on properties in this section, see the Common Section section in Properties Common in the Page Editor.

Styling

Design Properties Section

The Design Properties allow you to change spacing and alignment of the widget and hide it on phone, tablet, or desktop, if needed. Design properties may vary depending on the type of the widget. For example, for the text widget you can change its font weight, color, alignment, and letter case.

Common Section

For more information on properties in this section, see the Common Section section in Properties Common in the Page Editor.

Performing Specific Actions

To perform actions on a snippet call, select it on a page and right-click it. The list of possible actions opens. While some actions from this list, such as Select snippet, are a quick way to set the properties, the following actions are specific actions that you can perform:

  • Show snippet – opens a snippet selected for a snippet call
  • Inline snippet – turns the snippet call into widgets that the selected snippet consists of

Inline Snippet

When you select Inline snippet, Studio Pro will analyze the snippet call to determine if it is safe to inline. If it is safe, the following will occur:

  • The snippet call will be replaced by the contents of the snippet
  • All references to the snippet parameters will be rewritten to refer to the objects to which they are mapped in the Snippet settings of the snippet call

This is basically the inverse operation of Extract Snippet.

Not every snippet call can be inlined, because certain configurations cannot be represented correctly outside a snippet. Attempting to inline such a snippet call could result in a consistency error or produce inlined content which does not have the same behavior as the original snippet call. In this case, a warning dialog box is shown to ask whether you want to proceed:

Warning dialog for Inline snippet

Limitations

The following are examples of configurations which cannot be correctly inlined:

  • A Data view with a Context data source using an association of a snippet parameter (if that parameter has been mapped to an object which is not the directly surrounding object of the snippet call)
  • An attribute widget (such as Text box) using an attribute of a snippet parameter (if that parameter has been mapped to a page parameter in the snippet call)

In such cases, the inlined content needs to be fixed manually by adding or removing a Data view (depending on the configuration) and reconfiguring the affected widgets to refer to the correct object again.

Read More