uppdated modules
This commit is contained in:
@@ -326,10 +326,10 @@ function linkit_module_implements_alter(&$implementations, $hook) {
|
||||
* Implements hook_element_info_alter().
|
||||
*/
|
||||
function linkit_element_info_alter(&$types) {
|
||||
// Append a process function for the field integration.
|
||||
// Append a after_build function for the field integration.
|
||||
foreach (linkit_get_allowed_field_elements() as $element) {
|
||||
if (isset($types[$element])) {
|
||||
$types[$element]['#process'][] = 'linkit_process_field_element';
|
||||
$types[$element]['#after_build'][] = 'linkit_field_element_after_build';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ function linkit_element_info_alter(&$types) {
|
||||
if (in_array('ckeditor_pre_render_text_format', $types['text_format']['#pre_render'])) {
|
||||
$types['text_format']['#pre_render'][] = 'linkit_pre_render_editor_element';
|
||||
// Add the linkit library for the editor.
|
||||
drupal_add_library('linkit', 'ckeditor');
|
||||
$types['text_format']['#attached']['library'][] = array('linkit', 'ckeditor');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ function linkit_dashboard_form($form, &$form_state) {
|
||||
'#options' => $_profiles,
|
||||
'#ajax' => array(
|
||||
'callback' => 'linkit_change_profile',
|
||||
'wrapper' => 'linkit-dashbaord-ajax-wrapper',
|
||||
'wrapper' => 'linkit-dashboard-ajax-wrapper',
|
||||
'method' => 'replaceWith',
|
||||
'effect' => 'fade',
|
||||
'event' => 'click',
|
||||
@@ -577,7 +577,7 @@ function linkit_dashboard_form($form, &$form_state) {
|
||||
$form['linkit_container'] = array(
|
||||
'#type' => 'container',
|
||||
'#weight' => 100,
|
||||
'#prefix' => '<div id="linkit-dashbaord-ajax-wrapper">',
|
||||
'#prefix' => '<div id="linkit-dashboard-ajax-wrapper">',
|
||||
'#suffix' => '</div>',
|
||||
'#attached' => array(
|
||||
'js' => array(
|
||||
@@ -687,12 +687,12 @@ function linkit_autocomplete(LinkitProfile $profile) {
|
||||
|
||||
// Special for link to frontpage.
|
||||
if (strpos($search_string, 'front') !== FALSE) {
|
||||
$results = array_merge($results, array(
|
||||
$results[] = array(
|
||||
'title' => t('Frontpage'),
|
||||
'description' => 'The frontpage for this site.',
|
||||
'path' => url('<front>'),
|
||||
'group' => t('System'),
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
// Let the Linkit search plugins do their job.
|
||||
@@ -823,7 +823,10 @@ function linkit_parse_url($url, $parts) {
|
||||
// Internal URL.
|
||||
// We can not use the url_is_external() as it treats all absolute links as
|
||||
// external and treats all stream wrappers as internal.
|
||||
$local_url = trim($path_info['scheme'] . '://' . $path_info['host'] . base_path(), '/') == $base_url;
|
||||
$local_hosts = array($base_url);
|
||||
// Give other modules a chance to add/remove/alter the local hosts.
|
||||
drupal_alter('linkit_local_hosts', $local_hosts);
|
||||
$local_url = in_array(trim($path_info['scheme'] . '://' . $path_info['host'] . base_path(), '/'), $local_hosts);
|
||||
$local_stream_wrapper = isset($local_stream_wrappers[$path_info['scheme']]);
|
||||
//@TODO: maybe file_valid_uri() ?
|
||||
|
||||
@@ -1041,49 +1044,53 @@ function linkit_pre_render_editor_element($element) {
|
||||
static $processed = array();
|
||||
|
||||
if (!isset($processed[$element['#id']])) {
|
||||
// Load the first profile that is assign to this text format.
|
||||
$profile = linkit_profile_load_by_format($element['#format']);
|
||||
global $user;
|
||||
$all_formats = array_keys(filter_formats($user));
|
||||
|
||||
// If we dont have any profile, lets just return the element.
|
||||
if (!$profile) {
|
||||
return $element;
|
||||
}
|
||||
// Set the field ID.
|
||||
if (isset($element['value']['#id'])) {
|
||||
$field_id = $element['value']['#id'];
|
||||
}
|
||||
else {
|
||||
$field_id = $element['#id'] . '-value';
|
||||
$profiles_formats = array();
|
||||
|
||||
$use_imce = FALSE;
|
||||
|
||||
// First we need to figure out which formats that the current user can access have active Linkit profiles for them.
|
||||
foreach ($all_formats as $format) {
|
||||
// Load the first profile that is assigned to this text format.
|
||||
$profile = linkit_profile_load_by_format($format);
|
||||
|
||||
if ($profile) {
|
||||
if (isset($profile->data['imce']) && $profile->data['imce'] == 1) {
|
||||
$use_imce = TRUE;
|
||||
}
|
||||
$profiles_formats[$format] = array('profile' => $profile->name);
|
||||
}
|
||||
}
|
||||
|
||||
$field_js = array(
|
||||
'data' => array(
|
||||
'linkit' => array(
|
||||
'fields' => array(
|
||||
$field_id => array(
|
||||
'profile' => $profile->name,
|
||||
),
|
||||
if (!empty($profiles_formats)) {
|
||||
|
||||
$field_js = array(
|
||||
'data' => array(
|
||||
'linkit' => array(
|
||||
'formats' => $profiles_formats,
|
||||
),
|
||||
),
|
||||
),
|
||||
'type' => 'setting',
|
||||
);
|
||||
'type' => 'setting',
|
||||
);
|
||||
|
||||
// Configure Linkit to have an IMCE selector.
|
||||
if (module_invoke('imce', 'access') && isset($profile->data['imce']) && $profile->data['imce'] == 1) {
|
||||
$field_js['data']['linkit']['IMCEurl'] = url('imce', array('query' => array(
|
||||
'app' => 'Linkit|sendto@Drupal.linkit.IMCECallback',
|
||||
'absolute' => TRUE,
|
||||
)));
|
||||
// We will only serv public files with IMCE.
|
||||
$field_js['data']['linkit']['publicFilesDirectory'] = variable_get('file_public_path', conf_path() . '/files');
|
||||
// Configure Linkit to have an IMCE selector.
|
||||
if (module_invoke('imce', 'access') && $use_imce) {
|
||||
$field_js['data']['linkit']['IMCEurl'] = url('imce', array('query' => array(
|
||||
'app' => 'Linkit|sendto@Drupal.linkit.IMCECallback',
|
||||
'absolute' => TRUE,
|
||||
)));
|
||||
// We will only serv public files with IMCE.
|
||||
$field_js['data']['linkit']['publicFilesDirectory'] = variable_get('file_public_path', conf_path() . '/files');
|
||||
}
|
||||
|
||||
// Attach the linkit_base librar
|
||||
$element['#attached']['library'][] = array('linkit', 'base');
|
||||
$element['#attached']['js'][] = $field_js;
|
||||
|
||||
$processed[$element['#id']] = TRUE;
|
||||
}
|
||||
|
||||
// Attach the linkit_base librar
|
||||
$element['#attached']['library'][] = array('linkit', 'base');
|
||||
$element['#attached']['js'][] = $field_js;
|
||||
|
||||
$processed[$element['#id']] = TRUE;
|
||||
}
|
||||
|
||||
return $element;
|
||||
@@ -1139,14 +1146,14 @@ function linkit_get_insert_plugin_processed_path(LinkitProfile $profile, $uri, $
|
||||
switch ($profile->data['insert_plugin']['url_method']) {
|
||||
case LINKIT_URL_METHOD_RAW:
|
||||
$path = $uri;
|
||||
break;
|
||||
case LINKIT_URL_METHOD_RAW_SLASH:
|
||||
$options['alias'] = TRUE;
|
||||
$path = url($uri, $options);
|
||||
break;
|
||||
case LINKIT_URL_METHOD_ALIAS:
|
||||
$path = url($uri, $options);
|
||||
break;
|
||||
break;
|
||||
case LINKIT_URL_METHOD_RAW_SLASH:
|
||||
$options['alias'] = TRUE;
|
||||
$path = url($uri, $options);
|
||||
break;
|
||||
case LINKIT_URL_METHOD_ALIAS:
|
||||
$path = url($uri, $options);
|
||||
break;
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
||||
Reference in New Issue
Block a user