uppdated modules
This commit is contained in:
@@ -106,7 +106,6 @@ function _linkit_build_profile_type_form_fields(&$form, LinkitProfile $profile)
|
||||
$form['data']['profile_type'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Profile type'),
|
||||
'#description' => t(''),
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
'#tree' => FALSE,
|
||||
@@ -143,7 +142,6 @@ function _linkit_build_profile_type_form_fields(&$form, LinkitProfile $profile)
|
||||
'#empty_option' => t('- Select one or more text format- '),
|
||||
'#default_value' => isset($profile->data['text_formats'])
|
||||
? $profile->data['text_formats'] : array(),
|
||||
'#description' => t('.'),
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
// While waiting for https://drupal.org/node/879580 to be commited, we
|
||||
@@ -294,7 +292,7 @@ function _linkit_build_insert_plugin_form_fields(&$form, LinkitProfile $profile)
|
||||
),
|
||||
LINKIT_URL_METHOD_RAW_SLASH => array(
|
||||
'#description' => t('This is the default behavior, it will insert paths
|
||||
like %example_link.<br/>These will work <strong>without the need for a input filter</strong>,
|
||||
like %example_link.<br/>These will work <strong>without the need for an input filter</strong>,
|
||||
but might fail after moving a site, or on multilingual sites.',
|
||||
array('%example_link' => '/node/123')),
|
||||
),
|
||||
@@ -307,7 +305,7 @@ function _linkit_build_insert_plugin_form_fields(&$form, LinkitProfile $profile)
|
||||
$form['data']['insert_plugin']['url_method']['#options'][LINKIT_URL_METHOD_ALIAS] = t('Alias paths');
|
||||
$form['data']['insert_plugin']['url_method'][LINKIT_URL_METHOD_ALIAS] = array(
|
||||
'#description' => t('This will insert the alias for the result item.
|
||||
<br/>The paths will be runned thru the <em>url()</em> function.', array('%example_link' => 'node/123')),
|
||||
<br/>The paths will be run through the <em>url()</em> function.', array('%example_link' => 'node/123')),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -327,7 +325,7 @@ function _linkit_build_attribute_plugin_form_fields(&$form, LinkitProfile $profi
|
||||
$form['data']['attribute_plugins_fieldset'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Attributes'),
|
||||
'#description' => t('Attributes is HTML attributes that will be attached to
|
||||
'#description' => t('Attributes are HTML attributes that will be attached to
|
||||
the insert plugin.'),
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
@@ -417,7 +415,7 @@ function _linkit_build_autocomplete_form_fields(&$form, LinkitProfile $profile)
|
||||
$form['data']['autocomplete'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Autocomplete options'),
|
||||
'#description' => t('Linkit uses !bac which may be configured with focus on
|
||||
'#description' => t('Linkit uses !bac which may be configured with a focus on
|
||||
performance.', array('!bac' => l(t('Better Autocomplete'),
|
||||
'https://github.com/betamos/Better-Autocomplete'))),
|
||||
'#collapsible' => TRUE,
|
||||
|
||||
+26
-28
@@ -2,34 +2,32 @@
|
||||
* @file
|
||||
* HTML Link insert plugin for Linkit.
|
||||
*/
|
||||
(function ($) {
|
||||
(function($) {
|
||||
Drupal.linkit.registerInsertPlugin('html_link', {
|
||||
insert: function(data) {
|
||||
var linkitInstance = Drupal.settings.linkit.currentInstance,
|
||||
selection = linkitInstance.selection,
|
||||
text = linkitInstance.linkContent || data.path;
|
||||
|
||||
Drupal.linkit.registerInsertPlugin('html_link', {
|
||||
insert : function(data) {
|
||||
var text,
|
||||
selection = Drupal.settings.linkit.currentInstance.selection;
|
||||
// Delete all attributes that are empty.
|
||||
for (var attr in data.attributes) {
|
||||
if (data.attributes.hasOwnProperty(attr)) {
|
||||
delete data.attributes[attr];
|
||||
}
|
||||
}
|
||||
|
||||
// Delete all attributes that are empty.
|
||||
for (name in data.attributes) {
|
||||
(data.attributes[name]) ? null : delete data.attributes[name];
|
||||
if (selection && selection.text.length >= 1) {
|
||||
text = selection.text;
|
||||
}
|
||||
|
||||
// Use document.createElement as it is mush fasten then $('<a/>).
|
||||
return $(document.createElement('a'))
|
||||
.attr(data.attributes)
|
||||
.attr('href', data.path)
|
||||
.html(text)
|
||||
// Convert the element to a string.
|
||||
.get(0)
|
||||
.outerHTML;
|
||||
}
|
||||
|
||||
if (typeof selection != 'undefined' &&
|
||||
selection.text.length >= 1) {
|
||||
text = selection.text;
|
||||
}
|
||||
else {
|
||||
text = Drupal.settings.linkit.currentInstance.linkContent;
|
||||
}
|
||||
|
||||
// Use document.createElement as it is mush fasten then $('<a/>).
|
||||
return $(document.createElement('a'))
|
||||
.attr(data.attributes)
|
||||
.attr('href', data.path)
|
||||
.html(text)
|
||||
// Convert the element to a string.
|
||||
.get(0).outerHTML;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reprecents a Linkit entity search plugin.
|
||||
* Represents a Linkit entity search plugin.
|
||||
*/
|
||||
class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
|
||||
@@ -97,13 +97,13 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
* The entity label, or FALSE if not found.
|
||||
*/
|
||||
function createLabel($entity) {
|
||||
return check_plain(entity_label($this->plugin['entity_type'], $entity));
|
||||
return filter_xss(entity_label($this->plugin['entity_type'], $entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a search row description.
|
||||
*
|
||||
* If there is a "result_description", run it thro token_replace.
|
||||
* If there is a "result_description", run it through token_replace.
|
||||
*
|
||||
* @param object $data
|
||||
* An entity object that will be used in the token_place function.
|
||||
@@ -145,7 +145,7 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
$options['language'] = $languages[$entity->language];
|
||||
}
|
||||
}
|
||||
// Process the uri with the insert pluing.
|
||||
// Process the uri with the insert plugin.
|
||||
$path = linkit_get_insert_plugin_processed_path($this->profile, $uri['path'], $options);
|
||||
return $path;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a row class to appaned to the search result row.
|
||||
* Create a row class to append to the search result row.
|
||||
*
|
||||
* @param $entity
|
||||
* The entity object.
|
||||
@@ -194,7 +194,7 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
$this->query = new EntityFieldQuery();
|
||||
$this->query->entityCondition('entity_type', $this->plugin['entity_type']);
|
||||
|
||||
// Add the default sort on the enity label.
|
||||
// Add the default sort on the entity label.
|
||||
$this->query->propertyOrderBy($this->entity_field_label, 'ASC');
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
$entities = entity_load($this->plugin['entity_type'], $ids);
|
||||
|
||||
foreach ($entities AS $entity) {
|
||||
// Check the access againt the definded entity access callback.
|
||||
// Check the access against the defined entity access callback.
|
||||
if (entity_access('view', $this->plugin['entity_type'], $entity) === FALSE) {
|
||||
continue;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
// Get supported tokens for the entity type.
|
||||
$tokens = linkit_extract_tokens($this->plugin['entity_type']);
|
||||
|
||||
// A short description in within the search result for each row.
|
||||
// A short description within the search result for each row.
|
||||
$form[$this->plugin['name']]['result_description'] = array(
|
||||
'#title' => t('Result description'),
|
||||
'#type' => 'textfield',
|
||||
@@ -286,7 +286,7 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
'#description' => t('Available tokens: %tokens.', array('%tokens' => implode(', ', $tokens))),
|
||||
);
|
||||
|
||||
// If the token module is installed, lets make some fancy stuff with the
|
||||
// If the token module is installed, lets do some fancy stuff with the
|
||||
// token chooser.
|
||||
if (module_exists('token')) {
|
||||
// Unset the regular description if token module is enabled.
|
||||
@@ -295,17 +295,15 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
// Display the user documentation of placeholders.
|
||||
$form[$this->plugin['name']]['token_help'] = array(
|
||||
'#title' => t('Replacement patterns'),
|
||||
'#type' => 'fieldset',
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
'#type' => 'markup',
|
||||
);
|
||||
$form[$this->plugin['name']]['token_help']['help'] = array(
|
||||
'#theme' => 'token_tree',
|
||||
'#theme' => 'token_tree_link',
|
||||
'#token_types' => array($this->plugin['entity_type']),
|
||||
);
|
||||
}
|
||||
|
||||
// If there is bundles, add some default settings features.
|
||||
// If there are bundles, add some default settings features.
|
||||
if (count($this->entity_info['bundles']) > 1) {
|
||||
$bundles = array();
|
||||
// Extract the bundle data.
|
||||
@@ -331,4 +329,4 @@ class LinkitSearchPluginEntity extends LinkitSearchPlugin {
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class LinkitSearchPluginNode extends LinkitSearchPluginEntity {
|
||||
'#title' => t('Include unpublished nodes'),
|
||||
'#type' => 'checkbox',
|
||||
'#default_value' => isset($this->conf['include_unpublished']) ? $this->conf['include_unpublished'] : 0,
|
||||
'#description' => t('In order to see unpublished nodes, the user most also have permissions to do so. '),
|
||||
'#description' => t('In order to see unpublished nodes, the user must also have permissions to do so. '),
|
||||
);
|
||||
|
||||
return $form;
|
||||
|
||||
Reference in New Issue
Block a user