Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
search_config
Commits
d6241476
Commit
d6241476
authored
Oct 19, 2010
by
Joseph Yanick
Browse files
Default search option has been moved to core. Clean up
parent
ba6b2667
Changes
1
Hide whitespace changes
Inline
Side-by-side
search_config.module
View file @
d6241476
...
...
@@ -166,22 +166,20 @@ function search_config_form_alter(&$form, &$form_state, $form_id) {
unset
(
$form
[
'advanced'
][
'type'
]);
}
else
{
$types
=
node_type_get_types
();
foreach
(
$types
as
$module
=>
$type
)
{
if
(
$remove
[
$module
])
{
unset
(
$types
[
$module
]);
$content_types
=
node_type_get_types
();
foreach
(
$content_types
as
$machine_name
=>
$content_type
)
{
if
(
$remove
[
$machine_name
])
{
unset
(
$content_types
[
$machine_name
]);
}
else
{
$
types
[
$module
]
=
t
(
$type
)
;
$
options
[
$machine_name
]
=
$content_type
->
name
;
}
}
// Rebuild form item -- copied from node.module, but only if advanced
// fieldset exists.
if
(
!
empty
(
$form
[
'advanced'
]))
{
if
(
count
(
$types
)
==
1
)
{
$type_keys
=
array_keys
(
$types
);
if
(
count
(
$
content_
types
)
==
1
)
{
$type_keys
=
array_keys
(
$
content_
types
);
$form
[
'advanced'
][
'type'
]
=
array
(
'#type'
=>
'hidden'
,
'#default_value'
=>
$type_keys
[
0
],
...
...
@@ -193,7 +191,7 @@ function search_config_form_alter(&$form, &$form_state, $form_id) {
'#title'
=>
t
(
'Only of the type(s)'
),
'#prefix'
=>
'<div class="criterion">'
,
'#suffix'
=>
'</div>'
,
'#options'
=>
$types
,
'#options'
=>
$options
,
//
$types,
);
}
}
...
...
@@ -250,19 +248,6 @@ function search_config_form_alter(&$form, &$form_state, $form_id) {
}
}
/**
* Process a block search form submission.
*
* Taken from the core search module. It allows the search block to work
* with other default search types than node.
*/
function
search_config_form_submit
(
$form
,
&
$form_state
)
{
$form_id
=
$form
[
'form_id'
][
'#value'
];
$type
=
$form
[
'module'
][
'#value'
];
$form_state
[
'redirect'
]
=
'search/'
.
$type
.
'/'
.
trim
(
$form_state
[
'values'
][
$form_id
]);
}
function
search_config_validate
(
$form
,
&
$form_state
)
{
if
(
$form_state
[
'values'
][
'form_id'
]
==
'search_admin_settings'
&&
$form_state
[
'values'
][
'op'
]
==
t
(
'Save configuration'
))
{
...
...
@@ -313,22 +298,22 @@ function search_config_validate($form, &$form_state) {
*/
function
search_config_query_alter
(
QueryAlterableInterface
$query
)
{
$tables
=
$query
->
getTables
();
$search
=
array
(
$search
_tables
=
array
(
'i'
=>
'search_index'
,
'n'
=>
'node'
,
);
$intersection
=
array_intersect_key
(
$search
,
$tables
);
$intersection
=
array_intersect_key
(
$search
_tables
,
$tables
);
if
(
empty
(
$intersection
))
{
return
;
}
// Double check to ensure that the i and n aliases are pointing to
// the search index and node table.
foreach
(
$
intersection
as
$alias
=>
$table
)
{
if
(
$tables
[
$alias
][
'table'
]
!=
$table
)
{
foreach
(
$
search_tables
as
$alias
=>
$table
)
{
if
(
empty
(
$tables
[
$alias
])
OR
$tables
[
$alias
][
'table'
]
!=
$table
)
{
return
;
}
}
// Remove hidden content types.
$hidden_content_types
=
variable_get
(
'search_config_disable_index_type'
,
array
());
$hidden_content_types
=
array_filter
(
$hidden_content_types
);
if
(
!
empty
(
$hidden_content_types
))
{
...
...
Write
Preview
Supports
Markdown
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