Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Drupal.org issue queue
Drupal.org issue queue
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
project
drupal
Commits
054c8abf
Commit
054c8abf
authored
Mar 30, 2013
by
David_Rothstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1242602
by swentel, JvE, babruix | Chi: Fixed Notices in taxonomy_autocomplete().
parent
c9d21481
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
modules/taxonomy/taxonomy.pages.inc
modules/taxonomy/taxonomy.pages.inc
+2
-3
modules/taxonomy/taxonomy.test
modules/taxonomy/taxonomy.test
+7
-0
No files found.
modules/taxonomy/taxonomy.pages.inc
View file @
054c8abf
...
...
@@ -118,7 +118,7 @@ function taxonomy_term_feed($term) {
* @see taxonomy_menu()
* @see taxonomy_field_widget_info()
*/
function
taxonomy_autocomplete
(
$field_name
,
$tags_typed
=
''
)
{
function
taxonomy_autocomplete
(
$field_name
=
''
,
$tags_typed
=
''
)
{
// If the request has a '/' in the search text, then the menu system will have
// split it into multiple arguments, recover the intended $tags_typed.
$args
=
func_get_args
();
...
...
@@ -138,7 +138,7 @@ function taxonomy_autocomplete($field_name, $tags_typed = '') {
$tags_typed
=
drupal_explode_tags
(
$tags_typed
);
$tag_last
=
drupal_strtolower
(
array_pop
(
$tags_typed
));
$matches
=
array
();
$
term_
matches
=
array
();
if
(
$tag_last
!=
''
)
{
// Part of the criteria for the query come from the field's own settings.
...
...
@@ -167,7 +167,6 @@ function taxonomy_autocomplete($field_name, $tags_typed = '') {
$prefix
=
count
(
$tags_typed
)
?
drupal_implode_tags
(
$tags_typed
)
.
', '
:
''
;
$term_matches
=
array
();
foreach
(
$tags_return
as
$tid
=>
$name
)
{
$n
=
$name
;
// Term names containing commas or quotes must be wrapped in quotes.
...
...
modules/taxonomy/taxonomy.test
View file @
054c8abf
...
...
@@ -722,6 +722,13 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$this
->
assertFalse
(
field_info_field
(
$field_name
),
format_string
(
'Field %field_name does not exist.'
,
array
(
'%field_name'
=>
$field_name
)));
$this
->
drupalGet
(
'taxonomy/autocomplete/'
.
$field_name
.
'/'
.
$tag
);
$this
->
assertRaw
(
$message
,
'Autocomplete returns correct error message when the taxonomy field does not exist.'
);
// Test the autocomplete path without passing a field_name and terms.
// This should not trigger a PHP notice.
$field_name
=
''
;
$message
=
t
(
"Taxonomy field @field_name not found."
,
array
(
'@field_name'
=>
$field_name
));
$this
->
drupalGet
(
'taxonomy/autocomplete'
);
$this
->
assertRaw
(
$message
,
'Autocomplete returns correct error message when no taxonomy field is given.'
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment