Item Types

An item type is a sort of mold, from which you create new items -which means that an item type is a generic and powerful way of creating, managing and presenting content or data on a website.

You could, for instance, create item types tailor made for creating:

  • Blog posts
  • Newsletters
  • Contact forms
  • Employee profiles
  • Course descriptions (and signup)
  • Calendar events
  • Extending your website or page properties
  • Etc.

An item type contains of a number of item fields, which define what the item does (or contains) when created - for a blog post item, you probably want a rich text editor field, for instance - and a number of settings controlling item behavior.

Item types are created and managed from the item types section of the Settings area.

To create or work with item types:

  • Go to the Settings area
  • Click the Item types node to open the Item Types overview

To create an item type click New item type in the toolbar (Figure 2.1).

Figure 2.1 Creating an item type

This will open the item type settings dialog, which is used to define the type of item you are creating.

 

The item type settings are used to define the kind of item type you are creating - whether it is a page item, a paragraph item, or something else.

The basic item type settings (Figure 3.1) are common to all item types.

Figure 3.1 The basic item type settings

You can:

  • Name the item type – this is obligatory
  • Customize the system name of the item type. A system name is auto-generated from the name, but can be changed. The system name does not allow spaces or special characters – these will be replaced by an underscore when the item type is saved. The system name is stored in the database, and in an XML file placed in Files/Systems/Items
  • Provide a description of the item type. Do this to avoid problems down the line – you want people to know what an item is for, and what it does.

Below the basic setting you must specify the kind of item type you are creating (Figure 4.1).

Figure 4.1 You must enable your item type before it can be used

You can:

  • Enable the item type for website and page properties
  • Enable the item type for pages
    • Use this for item types, which create new pages (e.g. Newsletter items)
    • You must specify the default view when creating a new item. You can choose between the item view (showing item content fields) and the paragraph list view. Read more about working with item based pages.
  • Enable the item type for paragraphs
  • Enable the item type for ItemLists

To enable an item for one or more of the four areas, simply check the appropriate checkbox.

The rest of the item type settings share no universal label, although that does not indicate that they are unimportant (Figure 5.1).

Figure 5.1 Other miscellaneous item type settings

With the item type settings you can:

  • Select an icon for the item type to use in e.g. in the page tree and the paragraph list
  • Generate customized URLs when using the Item Publisher to publish items of his type.
    • If the item is a paragraph, the URL name is generated from paragraphname. If the item is a page item, the name is generated from the pagename (PageMenuTitle), UNLESS the Use in URL field is set on the page properties, in which case the value of that field is used.
  • Specify an item category - enter a path in the category field, e.g. MyCategory/MySubcategory/. If the category does not exist, it will be created on save. A category which contains no item types is automatically deleted.
  • Select a field in use field for title to use the value from that field as the page/paragraph title. You can select nested fields.
  • Using the Title field:
    • Combine field names and use them for the title using the following notation: {{Field1SystemName}} {{Field2SystemName}}
    • Leave blank to make the name editable
    • Use values from nested item fields: {{ItemFieldSystemName.NestedItemFieldSystemName}}
  • You can customize how items based on the item type are titles. You can use a field for the title, or you can specify a pattern of field system names to use in the Title setting. For instance, using {{Field1SystemName}} {{Field2SystemName}} creates a title based in the content from Field1 and Field2. Leave blank to make page/paragraph name editable.
  • You can select an item type to inherit fields from. Field settings are not inherited.

Once you have made your selections click OK - and then save the item type.

Once you have created an item type you must specify where it can be used.

To do so, click Restrictions on the item type ribbon (Figure 6.1).

Figure 6.1 Click the restrictions button to start editing your item type restrictions

This brings up the restrictions window (Figure 6.2).

Figure 6.2 You must customize the restrictions for an item type to allow it to be used in the intended manner

From here, you must:

  • Select which websites you want to use the item type on
    • When a website is selected, the item is available in the templates lists for e.g. pages and paragraphs.
    • If no websites are selected, the item won’t be available anywhere.
  • Select the allowed parents of an item type – that is, at what level an item type can be created. Only applies to page-items.
    • Allow in root of website makes the item type available at the root level (PageParentID=0)
    • Allow under regular page makes the item type available under non-item type based pages.
  • Specify which children are allowed under the item type.
    • You can select Regular page to allow non-item based pages as children, or one of your custom item types. For an item type called ‘Blog’, it would make sense to only allow child items of the item type ‘Blog post’, for instance.

Please note that you also restrict item type usage under the item type settings - this is where you control the type of item type, e.g. page item, paragraph item, etc.

It may be useful for you to have an overview of your item types, and how they are used.

Happy days! That overview is available to you, if you:

  • Go to Settings > Item types
  • Click Item type usage (Figure 7.1) in the toolbar
Figure 7.1 The item type usage button, located on your item type overview ribbon

This brings up the Item type usage overview (Figure 7.2), where you can see an overview of the places where an instance of an item type exists.

Figure 7.2 The item type usage overview

From the overview, you can:

  • Filter on item type
  • Filter on website
  • Filter on where an item is used

It is also possible to get an overview of the usage of a single item type.

Simply click Item type usage on the item type ribbon (Figure 7.3), to see an overview of where that particular item type is used.

Figure 7.3 Click Item type usage on a single item type to get an overview of where it is being used

All item types consist of one or more item fields.

To create an item field:

  • Open an item type
  • On the toolbar, click New field (Figure 8.1)
Figure 8.1 Click New field to add a new field to your item type

This brings up the field settings window - this is where you define the type of item field you are creating.

Figure 9.1 These settings are common to all field types

With the general settings you can:

  • Provide a name for the item field
  • Provide a custom system name for the field - or leave the one generated from the name. Remember, the system name doesn’t allow special characters or spaces. You will use the system name with template tags, when rendering the front end.
  • Provide a field description, which will be placed below the field in dimmed grey on the frontend.
  • Select a field type – e.g. Rich Text (for a rich text editor) or Password (for a password field). For a complete list of field and descriptions, read the following sections.

You also have access to field layout settings (Figure 9.2).

Figure 9.2 The field layout settings

With the layout settings, you:

You also have access to the field data settings (Figure 9.3).

Figure 9.3 The field data settings

The data setting – default value – enables you to enter a default value for the field.

The default values allowed are of course dependent on the field type – check boxes accept true/false, text fields accept text, integer fields accept integers, and so forth.

Please note, that currently file fields do not accept a default value starting with a / - so use 'images/favicon.png' and not '/images/favicon.png'.

You also have access to the field validation settings (Figure 10.1).

Figure 10.1 The field validation settings

With the validation settings, you can:

  • Set a field to be required – the user won’t be able to save the page or paragraph if a required field has not been filled.
  • Set up validation rules, to ensure that the values entered in the field conform to whatever standard you want to set up. You can enter a custom validation expression based on javascript RegEx, or select one from a list of standard expressions. Validation is only available for the field types Text, Long text, Hidden and Password.
  • Write an error message, if you want to inform the user that they have entered something which didn’t conform to the validation rule above.

In addition to these general settings, some field types have custom settings – these will be described in full under the field type descriptions below.

Context-sensitive default values

You can use values from the context as default values in item type fields.

To do so, use these context objects:

    @Request() – get value from System.Web.HttpContext.Current.Request
    @Session() – get value from System.Web.HttpContext.Current.Session
    @Page() – get value from current Page object, if any. (Current page exists if a valid PageID is in the query string).
    @User() – get value from the current User object.
    @Code() – evaluate C# code
    @Paragraph() – get value from current paragraph object, if any. (Current paragraph exists if a valid ParagraphID is in the query string).
    @ProductID() – get value from current product object, if any. (Current product exists if a valid ProductID is in the query string).


Examples:

    @Page(MenuText) – Get title of page
    @User(Name) – get name of user
    @User(Email) – get email of user
    @Code(System.DateTime.Now.AddDays(1)) – get tomorrow’s date
    @Code(1+2) – get 3 (possible, but stupid, granted)

An item type consists of a number of fields - and you have a lot of options when it comes to item type fields:

  • Text fields are for rendering various input fields for text
  • Link fields are for linking to folders, files and items 
  • Select box fields are for letting people select users or products, or for creating lists on the fly
  • Number and date fields are for specifying number or dates 
  • List fields are for letting users select values from various types of lists (with static or dynamic options)

Additionally, you have access to all the HTML5 input fields - and a number of cool-but-unique fields (like the color field and the geolocation field) grouped under the other fields label.

Text fields render input fields for text - these are your options:

Field type

Description

Parameters & Comments

Long text

Renders a multi-line input field for text

Use the extra parameters to control the size of the field in rows and columns

Rich text

Renders a text field and a rich text editor.

An extra parameter lets you select a custom editor configuration - if none is set the system checks if one has been set for the user, and finally defaults to the default configuration defined in Settings > Editing > Editor Configurations.

Text

Renders a simple input field for text (255 character limit).

None

Hidden field

“Renders” a hidden field for passing on values not entered by the user

If you make the field required and does not give it a default value or assign a value automatically to it, the user will not be able to save the item. So don't.

Password

Renders a text field where input is rendered as dots (rather than characters)

None

The link fields let you link to various types of content - internal and external pages, items, files and folders. Here are your options:

Field type

Description

Parameters & Comments

Link

Renders a control for selecting an internal page on the solution or a file from the file manager.

The extra parameters let you control what can be selected; pages, paragraphs or files.

 

You can also choose to only return the page or paragraph ID (rather than an URL). This field cannot be edited from frontend.

Link to item

Renders a control for linking to an item-base page or paragraph.

You can access the item fields of the selected item by using the Item.[LinkToItem].Fields loop.

Folder

Renders a file folder selector – the contents of the selected folder can then be rendered in frontend.

You can specify a search pattern in the field settings to only show files matching this pattern, e.g. *.xlsx to match all Excel files, or 2015-* to match files starting with 2015. Cannot be edited from frontend.

File

Renders a file selector

You can set the default folder and the selectable file extensions using the extra parameters in the field settings. You can also allow file upload and select a max number of files for editors to upload.

The select box fields let user select product or users when creating an item - you can then render user or product details in the frontend when the item is published. You can also let users create custom lists on the fly.

The select box field are:

Field type

Description

Parameters & Comments

User

Select users and user groups.

 

Basic user management tags and loops are available, so you can render various details about the selected users in frontend.

None

Product

Select one or more products or product groups. 

 

Basic product tags & loops are available for rendering the selected products/groups in frontend.

 

Select a paragraph with a product catalog which will be used to render the content in frontend. Specify whether products, product groups, or both may be selected using this field.

 

Inactive products can be selected, but will return a blank page in frontend.

 

Attention! This is NOT a replacement for the product catalog app, and you cannot search, sort or filter products selected with this field.

Editable list

Renders an input box for creating custom lists when creating the item.

Content can be added quicker by entering them in a comma-separated format. They will look a little bit wonky until you save the item type.

You have access to the following fields for adding number and date/datetime fields to your item types:

Field type

Description

Parameters & Comments

Decimal

Renders an field for specifying decimal numbers

Number formatting depends on your backend language; a Danish backend will have comma as the decimal mark and point as a thousands separator, whereas a US backend will have point as the decimal marker and comma as the thousands separator.

Integer

Renders a field for specifying integers (non-fractional numbers)

Number formatting depends on your backend language; a Danish backend will have point as a thousands separator, whereas a US backend will have comma as the thousands separator.

Date

Renders a date selector

To get current date preselected enter NOW as the default value in the field settings.

Date and time

Renders a date/time selector

To get current date preselected enter NOW as the default value in the field settings.

Using the list fields, you can add checkbox lists, a dropdown lists, or a radio button lists to your item types:

Field type

Description

Parameters & Comments

Checkbox list

Renders a list of checkboxes

Checkbox lists with a static source have extra parameters for styling the list options in a grid (each option must have an icon set).

Dropdown list

Renders a dropdown list

None

Radio button list

Renders a radio button list

Radio button lists with a static source have extra parameters for styling the list option in a grid (each option must have an icon).

When creating list fields, click the pencil to edit the field options. From here, you can also choose between three source types for the list options:

  • static source, where you manually provide labels and values for the list options 
  • An SQL source, where you retrieve a list of labels and values from a database using SQL
  • An Item type source, which allows you to generate list options based on instances of that item type

List field types also contain a checkbox for enabling/disabling encoding of list values. It is checked by default for compatibility reasons, but we recommend that you do not encode list values, as this makes it difficult to index and search for or facet on them.

For dropdown lists, you can also disable the nothing selected option in frontend, if you want the first list option to be preselected from the beginning.

HTML5 introduced new input types, and most of these are all available for item types. Please be aware that not all browsers support all the input types – if a browser does not support a field type, it will default to type text.

These are the available HTML5 input field types:

  • color
  • date
  • datetime
  • datetime local
  • email
  • month
  • number
  • password
  • range
  • tel
  • text
  • time
  • url
  • week

Selecting an HTML5 input field comes with extra parameters (Figure 17.1) for controlling the type and styling of the field.

Figure 17.1 Parameters for HTML5 fields

You can:

  • Select the type of control from the dropdown menu
  • Specify a regular expression pattern to check the input element’s value against – works with input types texturltelemail and password
  • Specify a short placeholder, describing the expected value of an input field – e.g. 70252090 for a Danish telephone number. Works with input types texturltelemail and password
  • Specify the size (width in characters) of an input element – use a non-negative integer greater than zero as value
  • Specify a minimum and maximum value of an input element. You can use a floating point number as the expected minimum and maximum values. Works with input types number, range, date, datetime, dagtetime-local, month, time and week.
  • Specify the legal number intervals (step) for an input element. You can insert a positive floating point number to specify the value granularity. Works with input types number, range, date, datetime, dagtetime-local, month, time and week.
  • Activate or deactivate autocomplete on the input field – works with input types texturltelemailpassworddatepickersrange, and color
  • Specify, that the element is a required part of the submission

You can read more about input types and attributes at w3.org.

In addition to the field types described above, you have access to the following field types:

Field type

Description

Parameters & Comments

Item relation list

Renders a control for adding lists of references to other items of a particular type, e.g. ‘Related News’ based on a News-item.

With the extra parameters you specify the item type selectable, sort by and sort order

Geolocation

Renders geo-location coordinates (format: 56.108145, 10.209894) based on values in other fields on the item

First, create address fields (e.g. Street, ZIP, City, etc.) on the item type where you want to use the geolocation field. Then enter a comma-separated list of the fields you want to use to look up the geolocation in the parameter field on the geolocation field - e.g. street,zip,city. The values entered in the address fields will then be used to look up and render a geolocation.

You can override the retrieved coordinates with your own by checking the override retrieved coordinates checkbox.

Color

Renders a color selector which lets you select a color, enter a color code or select a preset color

Preset colors are defined in item field settings using the ‘Presets’ field.

Checkbox

Renders a check box

None

Item type

Renders fields from another item type within this item type.

This field type lets you create little content blocks and reuse them again and again when building item types.

Google font Allows you to select a Google Font family and font weight You must provide a Google Fonts API key under Settings > Control panel > Item settings to use this - read more here

 

Item fields can be organized in groups. This allows you to set conditions for showing the field group - and user can collaps a field group if it's not relevant to them.

To create a field group, click New group on your item type ribbon (Figure 19.1).

Figure 19.1 Click New group to create, well, a new field group

This brings up the field group settings (Figure 19.2).

Figure 19.2 Field group settings

With these settings, you can:

  • Name the field group
  • Create a custom system name – or use the one generated from the name
  • Specify if a field group should be collapsible or not – and the default state (collapsed or not). Note that changing the settings will change the collapsed state on the same item type in all instances.
  • Specify conditions for showing the field group, based on the values of other fields in the item. For instance, you can have a field group only show up, if option A in a radio button list has been checked – or if the value of a text field matches a specific value.

To edit an item field:

  • Go to Setting > Item types
  • Open the item type 
  • Right-click on the field you wish to edit
  • Select Edit field from the right-click menu (Figure 20.1)
Figure 20.1 Edit a field by clicking the edit field button

To delete an item field, simply click Delete field from the right-click menu.

When you delete an item type, all item data for pages, paragraphs and websites will be deleted, and cannot be restored.

To delete an item type:

  • Go to the Settings area and click the Item types node in the settings tree to open the item type overvies
  • Either right click on the item and select Delete or click the red x-icon to the right of the item type (Figure 21.1)
Figure 21.1 Deleting an item type

This brings up the delete item type warning dialogue (Figure 21.2).

Figure 21.2 When deleting an item type, all item data is irreversibly removed

You can choose to keep your page and paragraph setup, but ALL item data will be removed, and the item based pages and paragraphs will be converted to normal pages/paragraphs.

Make your selection, then click OK.

Database

There is no database specific information for this subject.