You are here

README.txt in Linkit 6

Same filename in this branch
  1. 6 README.txt
  2. 6 editors/fckeditor/README.txt
Same filename and directory in other branches
  1. 7.3 readme.txt
  2. 7 README.txt
  3. 7.2 README.txt
-- INTRODUCTION --

Linkit provides an easy interface for internal linking. Linkit links to
nodes, users, views and terms by default, using an autocomplete field.
Linkit has two major advantages over traditional linking

 1. The user does not have to copy or remember a URL
 2. If the target node changes it's alias (e.g. if the node's menu item
    title is changed) the link will remain functional

See http://drupal.org/project/linkit for more information

-- INSTALLATION --

 1. Install and enable linkit and at least one of linkit_node,
    linkit_views, linkit_taxonomy or linkit_user.
 2 a. Enable the Linkit button in your WYSIWYG editor's settings.
 2 b. Enable the Linkit button in your CKEditor profile settings.
 2 c. If you are using stand alone FCKeditor, there is
    some more installation information the editor dir.
    (/sites/all/modules/linkit/editors/fckeditor/README.txt)


-- DEPENDENCIES --

Linkit dont have any "real" dependencies, but without these modules you dont 
get the fully functionality.

To begin, we need an editor. Linkit supports all of these editors:
 * WYSIWYG <http://drupal.org/project/wysiwyg> with TinyMCE or CKEditor
   or FCKeditor  (recommended)
 * CKEditor <http://drupal.org/project/ckeditor>
 * FCKeditor <http://drupal.org/project/fckeditor>

Linkit creates internal links with the "internal:" prefix. To make your site 
understand these links, you have to install _ONE_ of these modules.
* Path Filter <http://drupal.org/project/pathfilter> 
* Pathologic <http://drupal.org/project/pathologic>

Make sure Path Filter OR Pathologic is enabled on the input formats you intend to use with linkit

-- CONFIGURATION --

No additional configuration is necessary though you may fine-tune settings at
Administer -> Site configuration -> Linkit settings (/admin/settings/linkit).

To administrate this settings, you need "administer linkit" premission (/admin/user/permissions) or be user 1.

-- HOOKS --

The autocomplete field is extendeble, so you can easy extend it with your own plugins.
For example you may wan't to integrate a third party web service.

There are two hooks that MUST be defined if you want to extend the autocomplete field.

- hook_linkit_load_plugins() - Will load the plugin results.
- hook_linkit_info_plugins() - Will be used if linkit_permissions is enables.

- hook_linkit_get_search_styled_link() - Will be used when a link is being edited (This hook is not necessary).

There is also a hook that you can use if you what to alter the array that 
contains all the results that will be shown in the search result.

- hook_linkit_load_plugins_alter(&$results)
  See http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_alter/6 for more info.

-- HOOK EXAMPLE --

/**
 * hook_linkit_load_plugins()
 *
 * This hook will extend the linkit module autocompele field with your own
 * matches.
 */
function MYMODULENAME_linkit_load_plugins($string) {
  $matches = array();
  
  // Get foo´s
  $result = db_query_range("SELECT foo, bar FROM {foo_table} WHERE LOWER(foo) LIKE LOWER('%%%s%%')", $string, 0, 10);
  while ($foo = db_fetch_object($result)) {
    $matches['MYMODULETYPE'][] = array(
      'title' => $foo->foo,
      'path' => 'internal:' . $foo->path, 
      'information' => array(
        'type' => 'Foos',
        'info1' => 'value1',
        'info2' => 'value2',
        'info3' => 'value3',
      ),
    );
  }
  return $matches;
}
(For alias link, use "base_path().$foo->path" instead of "'internal:' . $foo->path")

/**
 * Implementation of hook_linkit_info_plugins().
 */
function MYMODULENAME_linkit_info_plugins() {
  $return['MYMODULENAME'] = array(
    'type' => 'MYMODULETYPE',
  );
  return $return;
}


/**
 * Implementation of hook_linkit_get_search_styled_link().
 */
function MYMODULETYPE_linkit_get_search_styled_link($string) {
  // Node links created with Linkit will always begin with "internal:"
  if(strpos($string, 'internal:') === FALSE) {
    return;
  }

  // Check to see that the link really is a node link
  $splitted_string = explode('/', str_replace('internal:', '', $string));
  if($splitted_string[0] != 'node') {
    return;
  }

  // This is a node link created with Linkit, try to grab the title and path now. 
  $result = db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.nid = %d"), $splitted_string[1]);
  $node = db_fetch_object($result);
  
  // No reault or no node was found
  if(!$result || !$node) {
    return;
  }

  return check_plain($node->title) . ' [path:internal:node/' . $node->nid . ']';
}

-- MAINTAINERS --

 * anon <http://drupal.org/user/464598>

File

README.txt
View source
  1. -- INTRODUCTION --
  2. Linkit provides an easy interface for internal linking. Linkit links to
  3. nodes, users, views and terms by default, using an autocomplete field.
  4. Linkit has two major advantages over traditional linking
  5. 1. The user does not have to copy or remember a URL
  6. 2. If the target node changes it's alias (e.g. if the node's menu item
  7. title is changed) the link will remain functional
  8. See http://drupal.org/project/linkit for more information
  9. -- INSTALLATION --
  10. 1. Install and enable linkit and at least one of linkit_node,
  11. linkit_views, linkit_taxonomy or linkit_user.
  12. 2 a. Enable the Linkit button in your WYSIWYG editor's settings.
  13. 2 b. Enable the Linkit button in your CKEditor profile settings.
  14. 2 c. If you are using stand alone FCKeditor, there is
  15. some more installation information the editor dir.
  16. (/sites/all/modules/linkit/editors/fckeditor/README.txt)
  17. -- DEPENDENCIES --
  18. Linkit dont have any "real" dependencies, but without these modules you dont
  19. get the fully functionality.
  20. To begin, we need an editor. Linkit supports all of these editors:
  21. * WYSIWYG with TinyMCE or CKEditor
  22. or FCKeditor (recommended)
  23. * CKEditor
  24. * FCKeditor
  25. Linkit creates internal links with the "internal:" prefix. To make your site
  26. understand these links, you have to install _ONE_ of these modules.
  27. * Path Filter
  28. * Pathologic
  29. Make sure Path Filter OR Pathologic is enabled on the input formats you intend to use with linkit
  30. -- CONFIGURATION --
  31. No additional configuration is necessary though you may fine-tune settings at
  32. Administer -> Site configuration -> Linkit settings (/admin/settings/linkit).
  33. To administrate this settings, you need "administer linkit" premission (/admin/user/permissions) or be user 1.
  34. -- HOOKS --
  35. The autocomplete field is extendeble, so you can easy extend it with your own plugins.
  36. For example you may wan't to integrate a third party web service.
  37. There are two hooks that MUST be defined if you want to extend the autocomplete field.
  38. - hook_linkit_load_plugins() - Will load the plugin results.
  39. - hook_linkit_info_plugins() - Will be used if linkit_permissions is enables.
  40. - hook_linkit_get_search_styled_link() - Will be used when a link is being edited (This hook is not necessary).
  41. There is also a hook that you can use if you what to alter the array that
  42. contains all the results that will be shown in the search result.
  43. - hook_linkit_load_plugins_alter(&$results)
  44. See http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_alter/6 for more info.
  45. -- HOOK EXAMPLE --
  46. /**
  47. * hook_linkit_load_plugins()
  48. *
  49. * This hook will extend the linkit module autocompele field with your own
  50. * matches.
  51. */
  52. function MYMODULENAME_linkit_load_plugins($string) {
  53. $matches = array();
  54. // Get foo´s
  55. $result = db_query_range("SELECT foo, bar FROM {foo_table} WHERE LOWER(foo) LIKE LOWER('%%%s%%')", $string, 0, 10);
  56. while ($foo = db_fetch_object($result)) {
  57. $matches['MYMODULETYPE'][] = array(
  58. 'title' => $foo->foo,
  59. 'path' => 'internal:' . $foo->path,
  60. 'information' => array(
  61. 'type' => 'Foos',
  62. 'info1' => 'value1',
  63. 'info2' => 'value2',
  64. 'info3' => 'value3',
  65. ),
  66. );
  67. }
  68. return $matches;
  69. }
  70. (For alias link, use "base_path().$foo->path" instead of "'internal:' . $foo->path")
  71. /**
  72. * Implementation of hook_linkit_info_plugins().
  73. */
  74. function MYMODULENAME_linkit_info_plugins() {
  75. $return['MYMODULENAME'] = array(
  76. 'type' => 'MYMODULETYPE',
  77. );
  78. return $return;
  79. }
  80. /**
  81. * Implementation of hook_linkit_get_search_styled_link().
  82. */
  83. function MYMODULETYPE_linkit_get_search_styled_link($string) {
  84. // Node links created with Linkit will always begin with "internal:"
  85. if(strpos($string, 'internal:') === FALSE) {
  86. return;
  87. }
  88. // Check to see that the link really is a node link
  89. $splitted_string = explode('/', str_replace('internal:', '', $string));
  90. if($splitted_string[0] != 'node') {
  91. return;
  92. }
  93. // This is a node link created with Linkit, try to grab the title and path now.
  94. $result = db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.nid = %d"), $splitted_string[1]);
  95. $node = db_fetch_object($result);
  96. // No reault or no node was found
  97. if(!$result || !$node) {
  98. return;
  99. }
  100. return check_plain($node->title) . ' [path:internal:node/' . $node->nid . ']';
  101. }
  102. -- MAINTAINERS --
  103. * anon