Anyone interested in finding path/url aliases with this module? To me this seemed like a relevant use case, so thanks to the very nice design for extending the module with plugins, I quickly modified the linkit_views plugin to create a plugin module to find aliases. Of course, you would want to limit access to this functionality to a trusted role as it exposes all url aliases.

Posting the module's code for feedback and the potential interest of others:

/**
 * Implementation of hook_linkit_load_plugins().
 */
function linkit_alias_linkit_load_plugins($string) {
  $matches = array();
  
  $result = db_query_range("SELECT * FROM {url_alias} WHERE LOWER(dst) LIKE LOWER('%%%s%%') ORDER BY length(dst) ASC", $string, 0, 10);
  while ($alias = db_fetch_object($result)) {
    $matches['alias'][] = array(
      'title' => $alias->dst,
      'path' => base_path() . $alias->src,
      'information' => array(
        'type' => 'Alias',
      ),
    );
  }  

  return  $matches;
}

/**
 * Implementation of hook_linkit_info_plugins().
 * 
 * This is used by linkit_permissions
 */
function linkit_alias_linkit_info_plugins() {
  $return['linkit_alias'] = array(
    'type' => 'alias',
  );
  return $return;
}

Comments

anon’s picture

Status: Active » Fixed

Nice, feel free to make your own module of this code as an "plugin'" to linkit.

I can link to it from the linkit project page if you like.

anon’s picture

Category: support » task

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.