Problem/Motivation

It is not possible to search for anything containing "front".

Proposed resolution

The error appears because of special case for link to frontpage:
(see linkit_autocomplete() function, file linkit.module, line 688)

  // Special for link to frontpage.
  if (strpos($search_string, 'front') !== FALSE) {
    $results = array_merge($results, array(
      'title' => t('Frontpage'), 
      'description' => 'The frontpage for this site.', 
      'path' => url('<front>'), 
      'group' => t('System'),
    ));
  }

The problem is that the second argument for array_merge() should be a nested array but not just a single array.
It can be fixed so (if we still need to use array_merge()):

  // Special for link to frontpage.
  if (strpos($search_string, 'front') !== FALSE) {
    $results = array_merge($results, 
      array(
        array(
          'title' => t('Frontpage'),
          'description' => 'The frontpage for this site.',
          'path' => url('<front>'),
          'group' => t('System'),
        )
      )
    );
  }

But actually, there is no reason to use array_merge(), so we can keep it simpler and better (we don't need to use extra function):

  // Special for link to frontpage.
  if (strpos($search_string, 'front') !== FALSE) {
    $results[] = array(
      'title' => t('Frontpage'),
      'description' => 'The frontpage for this site.',
      'path' => url('<front>'),
      'group' => t('System'),
    );
  }

It seems the problem exists for all 7.x-3.x releases, for 7.x-2.x releases it works properly.
I will create a patch to resolve the issue.

CommentFileSizeAuthor
#2 linkit_search_for_front-2414203-2.patch579 bytesshevchess

Comments

shevchess’s picture

Issue summary: View changes
shevchess’s picture

Status: Active » Needs review
StatusFileSize
new579 bytes

Adding a patch.

alcroito’s picture

Confirming, fixes the issue for me.

anon’s picture

Status: Needs review » Fixed

Thanks for the patch. This is now fixed in the dev.

  • anon committed 034153b on 7.x-3.x authored by shevchess
    Issue #2414203 by shevchess: Autocomplete doesn't work when searching...

Status: Fixed » Closed (fixed)

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

Status: Closed (fixed) » Needs work

The last submitted patch, 2: linkit_search_for_front-2414203-2.patch, failed testing.

anon’s picture

Status: Needs work » Closed (fixed)

Closing again, the test bot change the status for some reason.