You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
801 B
39 lines
801 B
<?php |
|
|
|
namespace Drupal\roblib_search\Plugin\Block; |
|
|
|
use Drupal\Core\Block\BlockBase; |
|
|
|
/** |
|
* Provides a search form. |
|
* |
|
* @Block( |
|
* id = "roblib_search_other_sources", |
|
* admin_label = @Translation("Roblib Search Other Sources"), |
|
* category = @Translation("Roblib Search"), |
|
* ) |
|
*/ |
|
class RoblibSearchOtherSourcesBlock extends BlockBase { |
|
|
|
/** |
|
* {@inheritdoc} |
|
*/ |
|
///roblib_search/ |
|
public function build() { |
|
$prefix = '/roblib_search/'; |
|
$query = $_SERVER['REQUEST_URI']; |
|
if (substr($query, 0, strlen($prefix)) == $prefix) { |
|
$query = substr($query, strlen($prefix)); |
|
} |
|
return [ |
|
'#theme' => 'roblib_search_other_sources', |
|
'#query' => $query, |
|
]; |
|
} |
|
|
|
public function getCacheMaxAge() { |
|
// don't cache this block |
|
return 0; |
|
} |
|
|
|
}
|
|
|