Now, we’ll actually configure the Linkit module to make creating links a painless endeavor.
Okay, now we’re ready to configure Linkit.
- Go to “Configuration => Content authoring => Linkit Profiles”
- Click the “Add New Profile” tab
Here we can create a profile for Linkit. You can create multiple profiles so that users can link to different types of entities, as well as use different HTML attributes in their links, based on user roles.
I’m just going to setup one generic Linkit profile for all users.
Basic configuration
- Administrative title: All users (You could create profiles for “Content Editors”, “Anonymous” etc.)
- Weight: This is used to dictate which profile a user is assigned. A user will be assigned the “heaviest” profile they have access to.
- Roles with Access
- [x] anonymous
- [x] authenticated (this will cover everyone with an account, so I can skip the rest.)
Linkit Plugins
These are the entities that can be referenced when using this Linkit profile. When you check a box here, additional settings will be made available below.
- [x] Node
- [x] User
Node Plugin Settings
- Result format: I’ll use the format “[node:author] - [node:url]” When I first experimented with this, I added the node type and title, but the results will already include the title, so I don’t need to add that, and I’m going to use the “Group by bundle” option below, so I’ll know what type each result is. So, this will display each results with its node author and URL.
- Type filter: I’m going to leave this blank so that all node types are searched. If you select node types here, the results will be limited to those node types only.
- Group by bundle: I’ll check this. This will group the results by node type, so all articles will be listed together, and all basic pages will be listed together. If unchecked, the results will simply be listed alphabetically.
- Add reverse menu trail to description: As it says here, if the result has a menu item, its menu trail will be added in reverse in the description.
- Include unpublished nodes: This option allows you to include unpublished nodes in the results.
User Plugin Settings
- Result format: I’ll just use the “[user:name]” token to display the user’s name in the results.
- Add reverse menu trail to description: This is the same as above.
IMCE File Picking
This will let us use IMCE to select files that we want to link to.
- [x] Enable IMCE file picking
HTML Attributes
These are the attributes that will be available when creating a link. Depending on the level of user access you may not want to allow some of the attributes. For example, permission to use the “class” attribute probably shouldn’t be given to anonymous users. For this example, I’ll enable the “title” attribute.
- [x] title
Autocomplete Options
Linkit uses “Better Autocomplete” instead of the native autocomplete feature that comes with Drupal. You can configure it’s settings here.
- Character limit: This is the number of characters that must be entered before the autocomplete search will begin.
- Key press delay: This is the amount of time that must pass after the last key press before the server will be polled.
- Remote timeout: This dictates how long the browser will wait for the server before it times out.
- (Save)
Now, we’re ready to add the Linkit button to our Wysiwyg. Let’s head back to our Wysiwyg settings and replace the standard link button with the Linkit button.
- Go to “Configuration => Content authoring => CKEditor” (admin/config/content/ckeditor)
- Click “edit” next to the “Advanced” profile
- Expand the “Editor Appearance” dropdown
- Drag the “Linkit’ button onto the toolbar
- Drag the standard “Link” and “Unlink” buttons off of the toolbar
- In the “Plugins” section, check the “Support for Linkit module” option
- (Save)