$provider) { $all[$key] = $provider; $all[$key]['type'] = 'standard'; } return $all; } /** * Loops through users apps to see if app is a search provider, might be worth * looking into caching this at some point * * @return Array */ public static function appProviders() { $providers = []; $userapps = Item::all(); foreach($userapps as $app) { if(empty($app->class)) continue; if(($provider = Item::isSearchProvider($app->class)) !== false) { $name = Item::nameFromClass($app->class); $providers[$app->id] = [ 'id' => $app->id, 'type' => $provider->type, 'class' => $app->class, 'url' => $app->url, 'name' => $app->title, 'colour' => $app->colour, 'icon' => $app->icon, 'description' => $app->description ]; } } return $providers; } /** * Outputs the search form * * @return html */ public static function form() { $output = ''; $homepage_search = Setting::fetch('homepage_search'); $search_provider = Setting::where('key', '=', 'search_provider')->first(); $user_search_provider = Setting::fetch('search_provider'); //die(print_r($search_provider)); //die(var_dump($user_search_provider)); // return early if search isn't applicable if((bool)$homepage_search !== true) return $output; $user_search_provider = $user_search_provider ?? 'none'; if((bool)$homepage_search && (bool)$search_provider) { if((bool)$user_search_provider) { $name = 'app.options.'.$user_search_provider; $provider = self::providerDetails($user_search_provider); $output .= '
'; $output .= '
'; $output .= '
'; $output .= ''; $output .= Form::text('q', null, ['class' => 'homesearch', 'autofocus' => 'autofocus', 'placeholder' => __('app.settings.search').'...']); $output .= ''; $output .= '
'; $output .= '
'; $output .= '
'; } } return $output; } }