Commit 43566580 authored by anon's avatar anon

Added #1462194: Title population for Link fields.

parent a6826a53
......@@ -30,6 +30,12 @@ Drupal.linkit.editorDialog.field = {
// Replace the field value.
Drupal.behaviors.linkit_field.replaceFieldValue(field.get(0), link);
}
// Link field can have a title field. If they have, we populate the title
// field with the search result title if any.
if (typeof field_settings.title_field != 'undefined' && typeof linkitCache.link_tmp_title != 'undefined') {
Drupal.behaviors.linkit_field.replaceFieldValue($('#' + field_settings.title_field).get(0), linkitCache.link_tmp_title);
}
}
};
......
......@@ -89,6 +89,10 @@ function linkit_process_widget(&$element) {
// Spcial settings for link fields.
if ($element['#type'] == 'link_field') {
$field_js['data']['linkit']['fields'][$field_id]['no_slash'] = TRUE;
// Link fields can have a title field.
if (isset($instance['settings']['title']) && in_array($instance['settings']['title'], array('optional', 'required'))) {
$field_js['data']['linkit']['fields'][$field_id]['title_field'] = $element['#id'] . '-title';
}
}
// Attach js files and settings Linkit needs.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment