Hey all, I'm searching for a way to limit the content types that are searched when adding links.  Particularly for this issue inside of CKEditor.  I'm working on a site that has dozens of nodes that start with the same text, and I can't reach the ones I'm looking for.

For instance, if I want to link the a basic page node called "Creativity & Culture" but there are dozens of nodes of a different type called Creativity & Culture with a date ( Creativity & Culture - 10/10/2001), I can't see the node I want to link to.  For the time being I'm entering the node ID, but that's not something I want my client to have to do.

So, is there a way I can control the node types searched with autocomplete? Or failing that, a way to increase the number of choices shown?

 

Comments

indigoxela's picture

Hi jbenjamin,

So, is there a way I can control the node types searched with autocomplete?

That's a bit tricky - there's no UI setting for that (as far as I know), but you can have full control via hook_form_alter. So it probably requires coding a custom module.

The form is filter_format_editor_link_form(), the item is "$form['href']". What you need to change is '#autocomplete_path' => 'path-autocomplete',

To provide the list of preferred node type results, it's probably easiest to create a view and output in the appropriate format with Views JSON.

Then, in a custom module, you'd implement hook_form_FORM_ID_alter, and change the #autocomplete_path to your custom views json output path.

As an alternative you can implement path_autocomplete_alter() - which seems completely undocumented, though.

The range is hardcoded in function path_autocomplete(), so there's no easy way to access that setting.