Helper/handler functions for dealing with unique "slugs", i.e. short human-readable strings that are part of the URL, e.g., for review subjects and teams.
- Source:
Methods
(static) getUpdateSlugHandler(spec) → {function}
Get a handler that can be attached to a model as an instance method for creating/updating human-readable string (slug) used in URL to identify the document.to create/update a unique
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
spec |
Object | specification for the handler Properties
|
- Source:
Returns:
See SlugName~_updateSlug.
- Type
- function
(async, inner) _updateSlug(userIDopt, language) → {model}
Handler for generating a slug from a configured multilingual string field, assigning it and saving it. Re-uses existing slugs that have previously pointed to the same document where posisble.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userID |
String |
<optional> |
user ID to attribute to this slug |
language |
String | which language should we look up from the source field? if it is not
identical to the |
- Source:
Returns:
the original document with the slug name assigned to its
.canonicalSlugName
field.
- Type
- model