Core Field Types
PyroCMS comes with a variety of field types in the Streams Core module that you can count on being available in PyroCMS 2.1 and above for your module.
Additionally, you can develop your own field types and add them to the addons folders inside a "field_type" folder. The Streams Type library will automatically look for them there.
Below is a reference of all the core PyroCMS field types.
- Choice
- Country
- Date Time
- Encrypt
- File
- Image
- Integer
- Pyro Lang
- Relationship
- Slug
- US State
- Text
- Textarea
- URL
- User
- WYSIWYG
- Year
Choice
The choice field type allows you to make drop downs, radio buttons, or check boxes.
Type Info
Slug | choice |
Column Type | VARCHAR or TEXT for checkboxes |
Column Storage | Stores the chosen value (key) or a newline-separated list of selected values for checkboxes. |
Extra Parameters
Parameter | Description |
---|---|
choice_data | A string of available choices, one on each line. They can either be simple values, or you can specify a key => value pair by separating them with a colon surrounded by 2 space. So, you could have y : Yes. Values can be language keys when prefixed by lang:. |
choice_type | The type of input you want to use. Accepted values are dropdown, radio, and checkboxes. |
default_value | For radio and dropdown this is the default value (or key, if you are using keys). For checkboxes, you can have multiple default values by putting them on separate lines. |
Country
The country field type creates a dropdown list of countries to choose from.
Type Info
Slug | country |
Column Type | VARCHAR |
Column Storage | Stores the country code. |
Date Time
The date/time field type stores date and time information. You can choose to just store the date, or store the date and time.
Type Info
Slug | datetime |
Column Type | DATE, DATETIME, or INT, depending on the storage option and choice to record time or just the date. |
Column Storage | Stores the timestamp in the column type format. |
Extra Parameters
Parameter | Values | Description |
---|---|---|
start_date | See the "Start/End Parameters" section below. | |
end_date | See the "Start/End Parameters" section below. | |
use_time | 'yes' or 'no' | Whether or not to save the time along with the date.. |
storage | 'datetime' or 'unix' | Date/time values can either be stored as a unix timestamp or a MySQL date/time format. |
input_type | 'datepicker' or 'dropdown' | Option to either use the jQuery datepicker or a series of drop downs for picking. |
Start/End Parameters
You can specify what date range that the user can select from by specifying the number of weeks, days, months, and years relative to the current date. You can specify them in the following format:
+1D +2W +2M +4Y
If you set this as the enddate, the user would be able to select a date up until 1 day. 2 weeks, 2 months, and 4 years into the future. You can use just one or any combination of the four. For instance, the following used for the startdate would allow the user to select a date 18 years before the current date.
-18Y
The email field type is similar to the text field, but adds validation for a valid email address and uses the HTML5 email input type that optimizes email input for mobile devices.
Type Info
Slug | |
Column Type | VARCHAR |
Column Storage | Stores the email address. |
Validation | Checks to make sure it is a valid email address. |
Encrypt
The encrypt field type stores a string as encrypted data in the database and decrypts it for output. Uses the CodeIgniter encryption library to encrypt the date and decrypt it before output.
Type Info
Slug | encrypt |
Column Type | BLOB |
Column Storage | Stores the encrypted string. |
Extra Parameters
Parameter | Values | Description |
---|---|---|
hide_typing | 'yes' or 'no' | If set to yes, the form input will be a password input instead of a regular text box. |
File
The file field type allows you to upload and link to a file.
Type Info
Slug | file |
Column Type | INT |
Column Storage | Stores the file id of a file in the files module. |
Extra Parameters
Parameter | Description |
---|---|
folder | Interfaces with the PyroCMS files module. Create an upload folder in the files module and select it here using the folder's id. |
allowed_types | Allowed types separated by pipe characters. Ex: doc|pdf. |
Image
The file field type allows you to upload and link to a file.
Type Info
Slug | image |
Column Type | INT |
Column Storage | The image field type allows you to upload and resize an image. |
Extra Parameters
Parameter | Description |
---|---|
folder | Interfaces with the PyroCMS files module. Create an upload folder in the files module and select it here using the folder's id. |
resize_width | Number of pixels to resize the image to width-wise. Can be left blank. |
resize_height | Number of pixels to resize the image to height-wise. If left blank while the Resize Width field is filled, this will be calculated based on the dimensions of the image. |
allowed_types | Allowed types separated by pipe characters. Ex: jpg|gif|png. |
Integer
The file field type allows you store an Integer value.
Type Info
Slug | integer |
Column Type | INT |
Column Storage | Stores an Integer. |
Validation | Checks to make sure it is an Integer. |
Extra Parameters
Parameter | Description |
---|---|
max_length | Maximum characters of the integer. |
default_value | Specify the value that will be used if none is provide. |
Pyro Lang
Shows a drop down of languages to choose from. You can filter them by available languages for the current theme.
Type Info
Slug | pyro_lang |
Column Type | VARCHAR |
Column Storage | Stores a language selection. |
Extra Parameters
Parameter | Value | Description |
---|---|---|
filter_theme | 'yes' or 'no' | Whether or not to filter language list by available languages for a theme. |
Relationship
The relationship field type allows you to link streams together by allowing you to choose an entry from another stream as an input, and have access to all the data from the connected entry on the front end.
Type Info
Slug | relationship |
Column Type | INT |
Column Storage | Stores relationship between streams |
Extra Parameters
Parameter | Description |
---|---|
choose_stream | The stream ID to pull the relationship entry from. (Caution : This is not the Stream Slug ) |
Slug
The slug field allows you to automatically generate a slug from another text field.
Type Info
Slug | slug |
Column Type | VARCHAR |
Column Storage | Stores a slug |
Extra Parameters
Parameter | Description |
---|---|
space_type | Allows you to choose the character that replaces whitespace. |
slug_field | The field that we should create a slug for. |
US State
The state field type creates a dropdown list of US states to choose from.
Type Info
Slug | state |
Column Type | VARCHAR |
Column Storage | Stores value from state dropdown. |
Extra Parameters
Parameter | Description |
---|---|
state_display | Allows you to choose between showing the full state name (ex: Florida) or the abbreviated version (ex: FL). |
Text
The simplest type of field, the text field allows you to enter in simple text data.
Type Info
Slug | text |
Column Type | VARCHAR |
Column Storage | Stores a string of text. |
Extra Parameters
Parameter | Description |
---|---|
max_length | Maximum length of the input. Defaults to 255 if blank. |
default_value | Specify the value that will be used if none is provide. |
Textarea
The textarea field type allows you to enter in large blocks of text.
Type Info
Slug | textarea |
Column Type | LONGTEXT |
Column Storage | Stores a large body text. |
Extra Parameters
Parameter | Description |
---|---|
default_value | Specify the value that will be used if none is provide. |
URL
The URL field type allows you to enter a URL for a website.
Type Info
Slug | url |
Column Type | VARCHAR |
Column Storage | Stores a url. |
Validation | Checks if URL is in a valid format EX: http://example.com. |
User
The user field type allows you to choose and return data for a user.
Type Info
Slug | user |
Column Type | INT |
Column Storage | Stores the id of a user. |
Extra Parameters
Parameter | Description |
---|---|
restrict_group | Allows restriction of the choice of user to a group. |
WYSIWYG
The WYSIWYG field creates a PyroCMS WYSIWYG text editor.
Type Info
Slug | wysiwyg |
Column Type | LONGTEXT |
Column Storage | Stores content from the WYSIWYG editor. |
Extra Parameters
Parameter | Default | Description |
---|---|---|
editor_type | simple | You can choose between a simple or advanced editor. |
Year
The Year field type creates a dropdown of years for you.
Type Info
Slug | year |
Column Type | CHAR |
Column Constraint | 4 |
Column Storage | Stores the year as a 4 digit integer. |
Validation | Checks if is an Integer. |
Extra Parameters
Parameter | Description |
---|---|
start_year | Specifies the year the dropdown should start with. |
end_year | Specifies the year the dropdown should stop at. |