Custom fields in EasyDNNnews module
The instructions on how to use custom fields in the EasyDNNnews
EasyDNNsolutions
The custom fields feature is available in the EasyDNNnews module from version 6. In 6.1 version this feature is significantly improved. Now there is a new feature – custom fields search functionality, which enables the EasyDNNnews module to be used in entirely new areas. Now you can also use EasyDNNnews for online catalogs, business directories, catalogs of cars or real estate, catalogs of products as well as all kinds of advertisement sections.
The standard article in the EasyDNNnews includes a title, subtitle, summary, content… We use custom fields when we have a need for additional fields that are not included in the standard fields.
The types of custom fields in EasyDNNnews are:
- TextBox
- Text
- Rich Text (HMTL)
- Integer
- Decimal
- Money
- CheckBox
- MultiControls
- DropDown list
- Radio Button list
- Check Box List
Custom fields groups
Custom fields in the EasyDNNnews are organized in groups. We can have more groups of custom fields depending on our needs. For example, we can have one group for cars and another for real estates. The group related to cars will contain fields relevant to cars and the group related to real estates will contain fields relevant for real estates.
Creating a Custom field
To create a new custom field, click on the Custom fields button in Dashboard. Then click on the Add/Edit Custom Fields button in the Custom fields manager. Select a field type and fill the form with the necessary data. If you put your mouse pointer over the tooltips you can read more about each field.
At the end click on the Create field button.
Custom fields elements
When adding MultiControls (Drop down list, Radio button list or Check Box List) they contain custom fields elements. Elements can be normal or relative. The normal elements are not related to other fields. The related elements are related to other custom field element (E.g. a car model is related to a car maker. In this example the car maker is a normal element and the car model is a related element).
To add a normal element type check the Normal type, add the value for the element and click on the Create element button. Repeat the process for all elements that you want to add.
Creating a Custom Fields Group
To create a new group, click on the Manage Custom Fields Groups button. Enter the name for the group and click on the Create Group button. The created group will appear on the list of custom fields groups.
Now we need to add custom fields to this group. Click on Edit in front of the name of the custom field.
Here you can see a list of available custom fields that you can add in the group. As we add the available fields to the group, they appear on the list of fields in this group. We can add or remove custom fields from the group in any time.
Controlling of using Custom Fields when adding articles
How and when custom fields groups can be set in Settings > 19. Custom fields.
User can enable adding data to custom fields
When adding an article the user can enable adding data to custom fields.
User can disable adding data to custom fields
When adding an article the user can disable adding data to custom fields.
User can’t disable adding data to custom fields
When adding an article the user can’t disable adding data to custom fields. In this case the user must add data to custom fields.
Select default Custom field group
Here is possible to set a default custom field group for articles.
Select Custom field group in add or edit form
If the checkbox is checked then when adding an article the user can select a custom field group. If the checkbox is unchecked, the user can only add data to the default custom group.
Displaying Custom Fields
Custom fields are automatically displayed in any article where they are added. All our HTML templates contains the token. This token displays all custom fields added to an article.
– displays all custom fields in an article
Tokens for each custom field are also available in the Custom fields manger.
An example:
– displays the value of the custom field price
– displays the label and value of the custom field price
– displays only the label of the custom field price
Conditional tokens:
- if the custom filed value exist then the content between these two tokens is displayed
- if the custom field value does not exist then the content between these two tokes is displayed
Custom fields displayed in an article:
Use Custom fields search
It is possible to search and filter articles based on custom fields groups. Add the EasyDNNnewsSearch module to a page. Click on Edit settings.
First select an instance of the EasyDNNnews module where search results will be opened. Then select Advanced search.
Display header
If the checkbox is checked then the header above the search module is displayed. By default the header is “Advanced search”, but it can be changed to anything else in the resource file (AdvancedSearchHeader.text)
Select custom field group
Here you need to select a custom fields group which fields will be used in the advanced search.
Connect custom fields to custom fields group
Here is possible to connect categories of articles with custom fields groups. We use this functionality when we use one custom field groups for articles in one category and another custom field groups for articles in the second category, etc.
E.g. the category “Cars” is possible to connect to the custom fields group CarsCF that has custom fields related to cars. The category “Real estates” can be connected to the custom field group “RealEstatesCF” that has custom fields related to real estates. If the category “Cars” is selected from the categories menu, then in the advanced search are displayed the custom fields from the “CarsCF” group. When the “Real estate” category is selected the custom fields from the “RealEstatesCF” are used.
Module theme
Here you can select a theme for the advanced search module.
Module display style
Here you can select a style for the advanced search module.
Search all categories on portal
If the checkbox is checked all categories are displayed in the advanced search. If you uncheck the box you will give a possibility to select only the categories that you want to display.
Search all authors on portal
If the checkbox is checked all authors are displayed in the advanced search. If you uncheck the box you will give a possibility to select only the authors that you want to display.
At the end click on Save or Save & Close.
How to localize custom fields
As well as the EasyDNNnews module and custom fields are ready to be used on multilingual web sites. It is possible to localize text and rich text (HTML) fields and static elements (labels).
Text and rich text fields can be localized in the Add/Edit form by clicking on the Content localization button.
The labels of custom fields and the custom fields elements of the Multicontrols (Drop down list, Radio button list or Check Box List) can be localized in the Custom field manager.
Note: In order to be able to localize articles and custom fields, at least two languages must be added in DNN. A language in DNN can be added from the menu Admin > Advanced settings > Languages.