Example #1
0
 /**
  * Gets the current selected source
  * 
  * @throws \Exception
  * @return unknown
  */
 public static function current()
 {
     // Get the default source
     $default_source = \Search\Factory::defaultSource();
     // Get the current selected source (use the state), fallback = default
     $current_source = (new \Search\Models\Source())->populateState()->getState('filter.search', $default_source);
     // find the source
     if ($source_exists = \Search\Factory::source($current_source)) {
         $class = $source_exists['class'];
     } elseif ($source_exists = \Search\Factory::source($default_source)) {
         $class = $source_exists['class'];
     }
     if (empty($class) || !class_exists($class)) {
         throw new \Exception('Search Type Not Found');
     }
     return $source_exists;
 }