|
@@ -419,19 +419,30 @@ function materio_search_api_search_form($form, &$form_state){
|
|
|
global $user;
|
|
|
$form = array();
|
|
|
|
|
|
-
|
|
|
$args = arg();
|
|
|
$path = array_shift($args);
|
|
|
- $keys = implode('/', $args);
|
|
|
+ $keys = implode('/', $args);
|
|
|
+
|
|
|
+ if(user_access('use materio search api autocomplete')){ // use materio search api autocomplete | use materio search api filters
|
|
|
+ $query = new EntityFieldQuery();
|
|
|
+ $query->entityCondition('entity_type', 'node')
|
|
|
+ ->entityCondition('bundle', 'materiau')
|
|
|
+ ->propertyCondition('status', 1);
|
|
|
+ $count = $query->count()->execute();
|
|
|
+ $default_value = t("search among our !fiches cards", array("!fiches"=>$count));
|
|
|
+ }else{
|
|
|
+ $default_value = '';
|
|
|
+ }
|
|
|
|
|
|
$form['searchfield'] = array(
|
|
|
'#type' => 'textfield',
|
|
|
- '#default_value' => $path == 'explore' ? $keys : "", // TODO: set the search page path global or a variable in settings
|
|
|
+ '#default_value' => $path == 'explore' ? $keys : $default_value, // TODO: set the search page path global or a variable in settings
|
|
|
// '#value' => $keys,
|
|
|
'#autocomplete_path' => 'materiosearchapi/autocomplete/searchapi',
|
|
|
//'#autocomplete_path' => 'materiosearchapi/autocomplete/dbselect',
|
|
|
'#size' => 30,
|
|
|
'#maxlength' => 1024,
|
|
|
+ '#attributes' => array("default"=>$default_value),
|
|
|
);
|
|
|
|
|
|
if(user_access('use materio search api filters')){
|