Plugins/SimpleVocab

With the Simple Vocab plugin you can define a controlled vocabulary for any field using a simple interface. A controlled vocabulary is a list of predefined, authorized terms that are preselected by you or another administrator. This plugin even helps you build vocabularies using texts that already exist in your archive.

Configuring the Plugin

  • Install the plugin, and then go to the Simple Vocab tab in the top navigation bar in /admin.
  • Select the Element (all Dublin Core and item type metadata fields are available) you wish to have a controlled vocabulary.
  • Enter the custom terms you wish to be available for this element, one per line. To save your entries, click Add/Edit Vocabulary.
  • To delete the vocabulary, select the element (note, it should be starred), and the terms will appear in the text box below. Simply remove the terms and re-sumbit this form by clicking Add/Edit Vocabulary.

Viewing Terms Already in Use

You may view a list of texts for any selected element that currently exist in your archive. This list may be a useful reference for building controlled vocabulary, but be aware of some caveats:

  • Vocabulary terms must not contain newlines (line breaks).
  • Vocabulary terms are typically short and concise. If your existing texts are otherwise, avoid using a controlled vocabulary for this element.
  • Vocabulary terms must be identical to their corresponding texts.
  • Existing texts that are not in the vocabulary will be preserved — however, they cannot be selected in the item edit page, and will be deleted once you save the item.

Working with Other Plugins

Version 1.2 allows you to reveal an element's controlled vocabulary for users filling out the contribution form, (read more about the Contribution plugin).

Please note that you cannot offer different vocabularies for admin users and public users. If a vocabulary is set for an element, only those terms will be available if that specific element appears on the public contribution form.

simple_vocab_routes Filter

As of version 1.2, the SimpleVocab plugin includes a filter that plugin authors can use to activate the vocabulary on most any form.

add_filter(
    'simple_vocab_routes', 
    array('module' => {module}, 
          'controller' => {controller}, 
          'actions' => array({action}, {action}, {...}))
);