aceUISlugEditor

A slug editor widget that can automatically generate web-safe slug names based on string values anywhere in content data.

Minion

The primary use case of the aceUISlugEditor widget is to automatically generate web-safe slug names based on some other part of the content data being edited, such as the title of an article. Manual override is also allowed, but should only be used whenever a specific slug is needed for one reason or another.

Slugs will by default be generated on the format <slug>-<unique-ID> and the output of the widget should always be stored in the aceSlugInfo type, which is also an ACE Web standard aspect.

It will also display an external link to the content if the WebViewService is enabled. The WebViewServiceis enabled by providing configuration for it in the hosting application. For example see the about configuring Content web view in the ACE Content Developer.

The WebViewService expects the configured variant composer to output in this format:

aspects: {
  webView: {
    contentPath: 'some/path'
  }
}

Prerequisites

The required ACE type aceSlugInfo is located in ACE Web and needs to be available in the installation:

<dependency>
  <groupId>com.atex.ace.web</groupId>
  <artifactId>types</artifactId>
  <version>${ace-web.version}</version>
  <classifier>ace-content</classifier>
</dependency>

Configuration

Attribute Description Default
"allowSlugCustomization" boolean

Whether to allow manual customization and editing of the slug value.
true
"allowClear" boolean

Whether to enable the button to clear the contents of the slug editor field.
false
"generateSlugId" boolean

Whether the editor should automatically generate and append a short unique ID string to the slug value.
true

Localization

This widget has localization support in the form of the following properties:

  • aceUISlugEditor.slugId
  • aceUISlugEditor.missingCustomSlug
  • aceUISlugEditor.linkDisabled.title

Expected domain objects

This widget expects two domain objects:

  • slugBase: The source for automatically generated slugs. Any change to the data represented by this domain object will result in an updated slug value. The domain object should be of type string.
  • slugDataAspect: The aspect to store the generated / edited slug information in. Should be of type aceSlugInfo.

Example template json

{
  "label": "Slug",
  "widget": "aceUISlugEditor",

  "config": {
    "generateSlugId": true,
    "allowSlugCustomization": true
  },

  "domainObjects": {
    "slugDataAspect": "aceSlugInfo",
    "slugBase": "article/title"
  }
}