12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- The Synonyms module provides various functionality targeted at handling synonymous (similar) spelling of the same name.
- Currently the module only provides synonyms for Taxonomy Terms, though there are plans to extend it and to support synonyms for all entity types. There are few key concepts tightly integrated into Synonyms module that are worth knowing for the end user. They are:
- <dt>Field independency</dt>
- <dd>Synonyms can be stored in various manners in your database within fields attached to your entities. Since the fields are different (entity reference, text, etc) you can keep your synonyms in the most convenient way for you.</dd>
- <dt>Synonyms behaviors</dt>
- <dd>Having a list of synonyms doesn't really help much; what you want to do is something productive with them. That's where synonyms behaviors whatsoever come on stage. They are abstract self sufficient units of behavior that do something productive with synonyms. For example, here we have the autocomplete behavior, which introduces autocomplete text fields that do look up not only by term name but by its synonyms too. Synonyms behaviors can be added through other contributed modules, you're not locked down to what Synonyms module has to offer you.</dd>
- <dt>Synonyms behavior implementations</dt>
- <dd>Lastly, here is yet more abstract unit. Behavior implementations bridge between existing synonyms behaviors and existing fields that may contain synonyms. Imagine as if you had a table, where rows are fields attached to your entities and the columns are the existing synonyms behaviors. Behavior implementations fill in the cells of this table. So, for example, you could have behavior implementation for autocomplete feature for the entity reference field. It means that synonyms stored in entity reference fields can participate in the autocomplete functionality.</dd>
- Let's cover each of these important concepts in details.
- <h2>Field Independency</h2>
- As stated above, your synonyms can be saved in many different field types. Synonyms module ships support for storing synonyms in the following field types:
- <ul>
- <li>Text</li>
- <li>Term reference</li>
- <li>Entity reference</li>
- <li>Number</li>
- <li>Decimal</li>
- <li>Float</li>
- </ul>
- Other modules may extend this list by implementing "synonyms" behavior for other field types. The "synonyms" behavior is the most basic and general behavior that exists for synonyms. Basically, it's precisely the ability to extract synonyms from fields and to search for existence of a synonym within a field.
- <h2>Synonyms behaviors</h2>
- Synonyms behaviors are some useful for the end user features that leverage the synonyms data. Synonyms module ships with the following behaviors:
- <ul>
- <li>Synonyms: just the basic behavior which allows to extract synonyms from a field and to search for a synonym within a field. Normally we advice to enable this behavior for all fields that one way or another are seen as source of synonyms. This behavior has many various goodies, such as support for synonym-friendly Views contextual filter and panels argument, adding another entity as synonym, etc.</li>
- <li>Autocomplete: allows synonyms to participate in the synonyms friendly autocomplete functionality.</li>
- <li>Select: allows synonyms to participate in the synonyms friendly select.</li>
- <li>Search: behavior that integrates synonyms with Search module, i.e. your nodes can be found not only by names of the terms they reference, but also by the synonyms of those terms. It also integrates with <a href="https://www.drupal.org/project/term_search">Term Search</a> module in the same manner: when searching for terms you can also find them by their synonyms.</li>
- </ul>
- Similarly, as with field independency, other modules can introduce their own behaviors. If you are interested in introducing your own behavior, refer to <a href="&topic:synonyms/synonyms_behaviors&">synonyms behaviors</a> page.
- <h2>Behavior Implementations</h2>
- Behavior implementations connect behaviors to field types. Synonyms module ships the following set of behavior implementations:
- <table>
- <thead>
- <tr>
- <th>Field type \ Behavior</th>
- <th>General synonyms</th>
- <th>Autocomplete</th>
- <th>Select</th>
- <th>Search</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><b>Text</b></td>
- <td>implemented</td>
- <td>implemented</td>
- <td>implemented</td>
- <td>implemented</td>
- </tr>
- <tr>
- <td><b>Term reference</b></td>
- <td>implemented</td>
- <td>implemented</td>
- <td>implemented</td>
- <td>implemented</td>
- </tr>
- <tr>
- <td><b>Entity reference</b></td>
- <td>implemented</td>
- <td>implemented</td>
- <td>implemented</td>
- <td>implemented</td>
- </tr>
- </tbody>
- </table>
- Lastly, you as a website admin can enable or disable certain fields to participate in certain behaviors. So you have full control over how things get set up in your website. Additionally, some behaviors may provide additional configs, for example, the autocomplete behavior will ask you with what wording to suggest a term if it was matched by one of its synonyms.
- The referenced above table may be extended through hooks that Synonyms module provides. Feel free to study the hooks at synonyms.api.php file. Also, you may find it useful to read about <a href="&topic:synonyms/synonyms_behavior_implementation&">writing custom behavior implementation</a>.
|