Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
cb5397f2
Commit
cb5397f2
authored
Aug 13, 2013
by
Alex Pott
Browse files
Issue
#2046993
by damiankloip: Inject dependencies into ViewsExposedFilterBlock derivative class.
parent
0285ab15
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsExposedFilterBlock.php
View file @
cb5397f2
...
...
@@ -7,14 +7,16 @@
namespace
Drupal\views\Plugin\Derivative
;
use
Drupal\Component\Plugin\Derivative\DerivativeInterface
;
use
Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface
;
use
Drupal\Core\Entity\EntityStorageControllerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Provides block plugin definitions for all Views exposed filters.
*
* @see \Drupal\views\Plugin\block\block\ViewsExposedFilterBlock
*/
class
ViewsExposedFilterBlock
implements
DerivativeInterface
{
class
ViewsExposedFilterBlock
implements
Container
DerivativeInterface
{
/**
* List of derivative definitions.
...
...
@@ -23,6 +25,43 @@ class ViewsExposedFilterBlock implements DerivativeInterface {
*/
protected
$derivatives
=
array
();
/**
* The view storage controller.
*
* @var \Drupal\Core\Entity\EntityStorageControllerInterface
*/
protected
$viewStorageController
;
/**
* The base plugin ID that the derivative is for.
*
* @var string
*/
protected
$basePluginId
;
/**
* Constructs a ViewsExposedFilterBlock object.
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\Core\Entity\EntityStorageControllerInterface $view_storage_controller
* The entity storage controller to load views.
*/
public
function
__construct
(
$base_plugin_id
,
EntityStorageControllerInterface
$view_storage_controller
)
{
$this
->
basePluginId
=
$base_plugin_id
;
$this
->
viewStorageController
=
$view_storage_controller
;
}
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
,
$base_plugin_id
)
{
return
new
static
(
$base_plugin_id
,
$container
->
get
(
'plugin.manager.entity'
)
->
getStorageController
(
'view'
)
);
}
/**
* Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinition().
*/
...
...
@@ -39,7 +78,7 @@ public function getDerivativeDefinition($derivative_id, array $base_plugin_defin
*/
public
function
getDerivativeDefinitions
(
array
$base_plugin_definition
)
{
// Check all Views for displays with an exposed filter block.
foreach
(
views_get_all_views
()
as
$view
)
{
foreach
(
$this
->
viewStorageController
->
loadMultiple
()
as
$view
)
{
// Do not return results for disabled views.
if
(
!
$view
->
status
())
{
continue
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment