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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | linkit_search_for_front-2414203-2.patch | 579 bytes | shevchess |
Comments
Comment #1
shevchess commentedComment #2
shevchess commentedAdding a patch.
Comment #3
alcroito commentedConfirming, fixes the issue for me.
Comment #4
anonThanks for the patch. This is now fixed in the dev.
Comment #8
anonClosing again, the test bot change the status for some reason.