When a user enters a tag in a Publish Form, an auto-complete feature can provide suggested tags, allowing the user to add tags much more quickly because only part of the word needs to be entered.
Auto-completed tags are based on a list of terms, originating from various sources such as Drupal, WordPress, and so on, and are made available through a Server plug-in. When a user enters a term that does not exist in the source, it is added to the source (when allowed by that source).
Note: In this article we assume that Drupal 7 is used as the source. For information about using WordPress tags, see Using WordPress tags in a Publish Form.
Auto-completed tags are treated by subject, referred to by Drupal as taxonomies.
Example: Taxonomies can be countries, cities, people, movies, companies, and so on.
Adding a tag
In a Publish Form, tags need to be added in a specific field. Such a field is linked to a specific taxonomy meaning that for that field tags of only that taxonomy will be auto-completed. The purpose of the field therefore is to only enter tags that are related to that taxonomy (although a user is free to manually enter custom tags).
As a result, a Publish Form will therefore typically need multiple fields for adding keywords, each linked to its own taxonomy and each one used for entering tags about a specific subject.
Example: Suppose a field is linked to a taxonomy containing a vocabulary with a single term 'Netherlands'. When the user types any of the letters of the word 'Netherlands', the tag 'Netherlands' appears as a suggested tag. When doing the same in a field that is not linked to this taxonomy, a completely different set of tags appear depending on the available terms in that taxonomy.
Figure: Here, the letter 'N' is entered which triggers all terms containing the letter 'n' to appear: in this case only the term 'Netherlands'.
Suggested tags through auto-complete are added to a field by pressing Enter.
How auto-completed tags are displayed
The functionality of displaying suggested tags is provided by a Drupal field of a special type named 'Autocomplete term widget (tagging)'. Such a field needs to be linked to a Drupal taxonomy to make sure that tags that are related to the field type appear through auto-complete.This is done by creating a vocabulary, optionally pre-filling it with terms, and linking it to the field.
Again: only words that are part of the taxonomy are provided as a suggestion; when entering a word that is not part of the list, no suggestions appear.
Term caching and updating
When importing content types into Enterprise, the taxonomies are stored in a cache location in Enterprise Server. When doing this while a cache already exists, the cache is emptied and recreated based on the terms in Drupal. When a story is published, both the taxonomy as well as the Enterprise cache are updated with any terms that were not part of the source.
Example. Assume that the tag 'Belgium' is entered manually as a tag and that it does not exist in the taxonomy that is linked to the field. It therefore does not appear as a suggested tag. When the story is published, the tag 'Belgium' is added to the cache in Enterprise and to the taxonomy in Drupal. When the Publish Form is refreshed, the next time any of the letters of the word 'Belgium' are added in the field, 'Belgium' now appears as a suggested tag.
Configuration steps to perform
Note: The following steps describe how to set up Enterprise based on Drupal 7 as a source for auto-completing tags. It is assumed that a fully working Drupal 7 environment is set up, including content types for use as Publish Forms in Enterprise. In case another source needs to be used, make sure that a fully functioning connection to that source is set up through an Enterprise Server plug-in. The steps required for linking it to Enterprise fully depend on the implementation of the Server plug-in. For information about using WordPress tags, see Using WordPress tags in a Publish Form.
1. Setting up vocabularies
Step 1. In Drupal, add a vocabulary to the taxonomy by navigating to Structure > Taxonomy > Add vocabulary.
Note: When making use of automatically suggested tags using OpenCalais,use the WoodWing Enterprise Suggestion Entity field to enter one of the values listed below. This is needed because the auto-suggestion feature also makes use of vocabularies and expects these to be named using a specific name.
Show me the values
Step 2. Click Save.
Step 3. (Optional) Fill the vocabulary by adding terms (click the "add terms' link in the Taxonomy window).
Note: You can also decide to leave the vocabulary empty. This means that when a user enters a tag for the first time, no tags will be suggested. However, the entered tag is automatically added when the story is published. As soon as the Publish Form is refreshed, the added tags will be available as suggested tags.
2. Setting up term fields in the content type
Step 1. In Drupal, navigate to Structure > Content Types.
Step 2. Add a new field to a content type and use the following settings:
- Field type: Term reference
- Widget: Autocomplete term widget (tagging)
Step 3. Click Save.
The Field Settings appear.
Step 4. From the Vocabulary list, choose the vocabulary that corresponds to the field type.
Example: If the field is to be used for entering keywords related to movies, choose a vocabulary that contains movie names.
Step 5. Click Save field settings.
3. Importing the content types in Enterprise
Step 1. Import the content type in Enterprise Server:
Caution: When importing content types, any Publish Form templates that are already in the database are updated. This means that the content of existing Publish Form templates is replaced (but this can be beneficial when Publish Forms need to be updated).
Step 1a. In Enterprise Server, access the Drupal 7 Maintenance page.
- In Enterprise Server, click Integrations in the Maintenance menu or on the Home page. A page with all integrated services appears.
- Click Drupal 7. The "Import Content Types from Drupal 7" Maintenance page appears
Step 1b. Click Import to import the content types.
4. Improving performance
As an optional step, improve the performance of the auto-complete feature by installing a PHP optimizer such as Zend OPcache. See Installing Zend OPcache.
Do you have corrections or additional information about this article? Leave a comment! Do you have a question about what is described in this article? Please contact Support.
Please sign in to leave a comment.