|
|
|
|
@ -13,6 +13,7 @@ use Drupal\Core\Plugin\ContextAwarePluginInterface;
|
|
|
|
|
use Drupal\Core\Render\Element; |
|
|
|
|
use Drupal\Core\Routing\RouteMatchInterface; |
|
|
|
|
use Drupal\Core\Session\AccountInterface; |
|
|
|
|
use Drupal\views\Plugin\Block\ViewsBlock; |
|
|
|
|
use Symfony\Component\HttpFoundation\RequestStack; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -103,7 +104,7 @@ class BlockViewBuilder {
|
|
|
|
|
* @return array |
|
|
|
|
* A renderable array representing the content of the block. |
|
|
|
|
*/ |
|
|
|
|
public function build(string $id, array $configuration = [], bool $wrapper = TRUE): array { |
|
|
|
|
public function build(string $id, array $configuration = [], array $arguments = [], bool $wrapper = TRUE): array { |
|
|
|
|
|
|
|
|
|
$configuration += ['label_display' => BlockPluginInterface::BLOCK_LABEL_VISIBLE]; |
|
|
|
|
|
|
|
|
|
@ -131,6 +132,15 @@ class BlockViewBuilder {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Overrride contextual arguments if arguments parameter is being passed |
|
|
|
|
// and the instance is of type ViewBlock |
|
|
|
|
if ($block_plugin instanceof ViewsBlock) { |
|
|
|
|
if (!empty($arguments)) { |
|
|
|
|
$view = $block_plugin->getViewExecutable(); |
|
|
|
|
$view->args = $arguments; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Place the content returned by the block plugin into a 'content' child |
|
|
|
|
// element, as a way to allow the plugin to have complete control of its |
|
|
|
|
// properties and rendering (for instance, its own #theme) without |
|
|
|
|
|