Plugin: Install and Configure More Custom Fields


Install

To use More Custom Fields, you’ll first need to get the files in place on your server.

  1. Get More Custom Fields by downloading from Github. Extract the archive.
  2. Upload the plugins/ folder to your Movable Type Pro installation.
  3. This plugin requires a newer version of the YAML::Tiny Perl module (1.4.4) than is included with Movable Type. Included with this plugin (in the extlib/ folder) is a newer version of YAML::Tiny. Copy from the plugin archive extlib/YAML/Tiny.pm to $MT_HOME/extlib/YAML/Tiny.pm to update Movable Type’s copy of this plugin. This is a required, non-optional step!
  4. This plugin requires a newer version of the jQuery library (1.7.x or greater) than is included with Movable Type. Included with this plugin (in the jQuery/ folder) is a newer version of JQuery. Copy from jQuery/jquery.js to $MT_HOME/mt-static/jquery/jquery.js to update Movable Type’s copy of jQuery. * This is a required, non-optional step!*

Movable Type 5, Additional Installation Notes

Install as noted above. Be sure to update YAML::Tiny as instructed.

Movable Type 5.1x includes jQuery version 1.4.x and so needs to be updated. Movable Type 5.2 includes jQuery version 1.7.2 and therefore does not need to be updated.

Static content needs to be copied. (This is handled automatically with Movable Type 4 and Config Assistant, but needs to be manually done with MT5.) Copy the contents of $MT_HOME/plugins/MoreCustomFields/static/ to $MT_HOME/mt-static/support/plugins/morecustomfields/.

Configure

newfield.png

More Custom Fields creates several additional field types that are available when defining custom fields:

  • Checkbox Group
  • Message
  • Multi-Use Single-Line Text Group
  • Multi-Use Time Stamped Multi-Line Text
  • Radio Buttons with Input
  • Reciprocal Entry Association
  • Reciprocal Page Association
  • Selected Entries
  • Selected Pages
  • Selected Entries or Pages
  • Selected Assets (and “child” types: Selected Images, Selected Audios, Selected Videos, Selected Files, and any other type of registered asset)

Use these field types as you would any other: from the Preferences menu select Custom Fields, and create a new custom field.

The Checkbox Group field type options should be specified in a comma-delimited list. Each item in the list will become a checkbox.

The Message field type should receive a default value. This value is the “message” displayed for all other users. The field options allow you to specify whether no user should be able to edit the field data, or if administrators should be able to override the supplied default.

The Multi-Use Single-Line Text Group field type is a mouthful. A breakdown of this field: The Single-Line Text field is included with MT Pro and lets you create a one-line text field. This field type can have many single-line text fields grouped together. Lastly, this is a multi-use field and provides an “add another group” button to add a limitless recurrence of the text fields you’ve defined. A popular use for this is to display URLs (with “Link Name” and “Link URL” text fields), and being multi-use means that an author can provide many URLs. Specify a comma-separated list of text field labels. Example: “Link Name,Link URL”.

The Multi-Use Time Stamped Multi-Line Text field type is another mouthful. Breaking down this field: The Multi-Line Text field is included with MT Pro and lets you create a textarea field. This field type also lets you create a textarea field, and it can be re-used over and over simply by clicking an “add another…” link. Additionally, each instance of the textarea is saved with a time stamp, marking when the data in that textarea was added. This field has no options.

The Radio Buttons with Input field type options should be specified in a comma-delimited list. Each item in the list will become a radio button. The last item in the list will have a text input field appended to it, so you’ll likely want to specify the last item as “Other” or similar.

The Reciprocal Entry Association and Reciprocal Page Association field types allow you to link to an object of the same type, and automatically create a reciprocal link: when you link Entry A and Entry B, Entry B is automatically linked to Entry A. Note that the Reciprocal Entry Association field can only associate Entries, and that the Reciprocal Page Association field can only associate Pages. This field is non-functional for categories, folders, and users. Specify a blog ID as this field’s option to determine which blog’s Entries (or Pages) are available for selection. Blog IDs must be separated with a comma to create a string (as in “1,12,19,37,112”), or the value “all” may be used to include all blogs. Leaving this field blank will use the current blog.

The Selected Entries, Selected Pages, and Selected Entries or Pages field types provides the ability to select those object types — as many as needed, sortable in whatever order is needed. Specify a blog ID as this field’s option to determine which blog’s objects are available for selection. Blog IDs must be separated with a comma to create a string (as in “1,12,19,37,112”), or the value “all” may be used to include all blogs. Leaving this field blank will make the current blog’s objects available.

The Selected Assets field type (and the related asset types) work similar to the Selected Entries field type: select an unlimited number of assets and sort in any order you wish. This field type has no options and works on the current blog only.

Lastly, use your new fields! Don’t forget to place them in your templates.

Using More Custom Fields with your Theme

If you’re building your site as a theme, custom fields can be specified and automatically created when the theme is applied (refer to Theme Manager for more information). A list of the field types along with their keys is below, which may help expedite your theme creation.

  • Checkbox Group: checkbox_group
  • Message: message
  • Multi-Use Single-Line Text Group: multi_use_single_line_text_group
  • Multi-Use Time Stamped Multi-Line Text: multi_use_timestamped_multi_line_text
  • Radio Buttons (with Input field): radio_input
  • Reciprocal Entry Association: reciprocal_entry
  • Reciprocal Page Association: reciprocal_page
  • Selected Assets: selected_assets
  • Selected Entries: selected_entries
  • Selected Pages: selected_pages
  • Selected Entries or Pages: selected_content

Note that the Selected Assets field actually creates a different custom field for each type of asset field available (Selected Images, Selected Videos, etc). These fields can also be used, though because they are dynamically generated you’ll need to determine the name of the field yourself. The following format is followed:

selected_[asset type]s

So, valid field types defined by the Community Pack would include:

  • Selected Audios: selected_asset.audios
  • Selected Images: selected_asset.images
  • Selected Videos: selected_asset.videos