|
|
|
@ -3,6 +3,7 @@ |
|
|
|
namespace Drupal\roblib_search_eds\Plugin\Block; |
|
|
|
namespace Drupal\roblib_search_eds\Plugin\Block; |
|
|
|
|
|
|
|
|
|
|
|
use Drupal\Core\Block\BlockBase; |
|
|
|
use Drupal\Core\Block\BlockBase; |
|
|
|
|
|
|
|
use Drupal\Core\Cache\Cache; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Provides EDS Article search results. |
|
|
|
* Provides EDS Article search results. |
|
|
|
@ -40,10 +41,21 @@ class RoblibSearchEdsArticles extends BlockBase { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@inheritdoc} |
|
|
|
* {@inheritdoc} |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* The block only renders a placeholder and settings; results are fetched |
|
|
|
|
|
|
|
* client side from uncached JSON endpoints, so the markup can be cached. |
|
|
|
|
|
|
|
* Setting max-age 0 here would make BigPipe stream the block in later. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getCacheMaxAge() { |
|
|
|
public function getCacheTags() { |
|
|
|
// Reading dynamic content from external source so no caching. |
|
|
|
return Cache::mergeTags(parent::getCacheTags(), ['config:roblib_search_eds.settings']); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* {@inheritdoc} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function getCacheContexts() { |
|
|
|
|
|
|
|
// The search URL in drupalSettings includes the scheme and host. |
|
|
|
|
|
|
|
return Cache::mergeContexts(parent::getCacheContexts(), ['url.site']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|