Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
219
Merge Requests
219
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
7f2710be
Commit
7f2710be
authored
Aug 21, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2315333
by tim.plunkett: Move block plugin code out of block.module.
parent
f3c0bc05
Changes
51
Hide whitespace changes
Inline
Side-by-side
Showing
51 changed files
with
136 additions
and
127 deletions
+136
-127
core/core.services.yml
core/core.services.yml
+3
-0
core/lib/Drupal/Core/Block/Annotation/Block.php
core/lib/Drupal/Core/Block/Annotation/Block.php
+2
-2
core/lib/Drupal/Core/Block/BlockBase.php
core/lib/Drupal/Core/Block/BlockBase.php
+6
-5
core/lib/Drupal/Core/Block/BlockManager.php
core/lib/Drupal/Core/Block/BlockManager.php
+6
-10
core/lib/Drupal/Core/Block/BlockManagerInterface.php
core/lib/Drupal/Core/Block/BlockManagerInterface.php
+2
-2
core/lib/Drupal/Core/Block/BlockPluginInterface.php
core/lib/Drupal/Core/Block/BlockPluginInterface.php
+6
-6
core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
+8
-0
core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
...dules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
+1
-1
core/modules/block/block.api.php
core/modules/block/block.api.php
+8
-8
core/modules/block/block.services.yml
core/modules/block/block.services.yml
+0
-3
core/modules/block/src/BlockInterface.php
core/modules/block/src/BlockInterface.php
+1
-1
core/modules/block/src/BlockListBuilder.php
core/modules/block/src/BlockListBuilder.php
+3
-3
core/modules/block/src/BlockPluginBag.php
core/modules/block/src/BlockPluginBag.php
+1
-1
core/modules/block/src/Controller/CategoryAutocompleteController.php
...s/block/src/Controller/CategoryAutocompleteController.php
+3
-3
core/modules/block/src/Event/BlockConditionContextEvent.php
core/modules/block/src/Event/BlockConditionContextEvent.php
+1
-1
core/modules/block/src/Event/BlockEvents.php
core/modules/block/src/Event/BlockEvents.php
+1
-1
core/modules/block/src/Tests/BlockConfigSchemaTest.php
core/modules/block/src/Tests/BlockConfigSchemaTest.php
+1
-1
core/modules/block/src/Tests/BlockInterfaceTest.php
core/modules/block/src/Tests/BlockInterfaceTest.php
+1
-1
core/modules/block/tests/modules/block_test/block_test.module
.../modules/block/tests/modules/block_test/block_test.module
+1
-1
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php
...es/block_test/src/Plugin/Block/TestBlockInstantiation.php
+1
-1
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php
...ts/modules/block_test/src/Plugin/Block/TestCacheBlock.php
+1
-1
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
...les/block_test/src/Plugin/Block/TestContextAwareBlock.php
+1
-1
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestHtmlBlock.php
...sts/modules/block_test/src/Plugin/Block/TestHtmlBlock.php
+1
-1
core/modules/block/tests/src/CategoryAutocompleteTest.php
core/modules/block/tests/src/CategoryAutocompleteTest.php
+1
-1
core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
...ules/block_content/src/Plugin/Block/BlockContentBlock.php
+5
-5
core/modules/book/src/Plugin/Block/BookNavigationBlock.php
core/modules/book/src/Plugin/Block/BookNavigationBlock.php
+1
-1
core/modules/forum/src/Plugin/Block/ForumBlockBase.php
core/modules/forum/src/Plugin/Block/ForumBlockBase.php
+1
-1
core/modules/language/language.admin.inc
core/modules/language/language.admin.inc
+0
-18
core/modules/language/src/Form/NegotiationConfigureForm.php
core/modules/language/src/Form/NegotiationConfigureForm.php
+39
-13
core/modules/language/src/Plugin/Block/LanguageBlock.php
core/modules/language/src/Plugin/Block/LanguageBlock.php
+1
-1
core/modules/menu_ui/menu_ui.module
core/modules/menu_ui/menu_ui.module
+1
-1
core/modules/node/src/Plugin/Block/SyndicateBlock.php
core/modules/node/src/Plugin/Block/SyndicateBlock.php
+1
-1
core/modules/search/src/Plugin/Block/SearchBlock.php
core/modules/search/src/Plugin/Block/SearchBlock.php
+1
-1
core/modules/shortcut/src/Plugin/Block/ShortcutsBlock.php
core/modules/shortcut/src/Plugin/Block/ShortcutsBlock.php
+1
-1
core/modules/statistics/src/Plugin/Block/StatisticsPopularBlock.php
...es/statistics/src/Plugin/Block/StatisticsPopularBlock.php
+1
-1
core/modules/system/src/Form/PerformanceForm.php
core/modules/system/src/Form/PerformanceForm.php
+1
-1
core/modules/system/src/Plugin/Block/SystemBrandingBlock.php
core/modules/system/src/Plugin/Block/SystemBrandingBlock.php
+1
-1
core/modules/system/src/Plugin/Block/SystemBreadcrumbBlock.php
...modules/system/src/Plugin/Block/SystemBreadcrumbBlock.php
+1
-1
core/modules/system/src/Plugin/Block/SystemHelpBlock.php
core/modules/system/src/Plugin/Block/SystemHelpBlock.php
+1
-1
core/modules/system/src/Plugin/Block/SystemMainBlock.php
core/modules/system/src/Plugin/Block/SystemMainBlock.php
+1
-1
core/modules/system/src/Plugin/Block/SystemMenuBlock.php
core/modules/system/src/Plugin/Block/SystemMenuBlock.php
+1
-1
core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php
.../modules/system/src/Plugin/Block/SystemPoweredByBlock.php
+1
-1
core/modules/system/system.module
core/modules/system/system.module
+1
-1
core/modules/system/tests/modules/form_test/src/Plugin/Block/RedirectFormBlock.php
.../modules/form_test/src/Plugin/Block/RedirectFormBlock.php
+1
-1
core/modules/user/src/Plugin/Block/UserLoginBlock.php
core/modules/user/src/Plugin/Block/UserLoginBlock.php
+1
-1
core/modules/views/src/Plugin/Block/ViewsBlockBase.php
core/modules/views/src/Plugin/Block/ViewsBlockBase.php
+1
-1
core/modules/views/src/Plugin/views/display/Block.php
core/modules/views/src/Plugin/views/display/Block.php
+2
-5
core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php
core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php
+1
-2
core/modules/views/tests/src/Plugin/views/display/BlockTest.php
...odules/views/tests/src/Plugin/views/display/BlockTest.php
+5
-5
core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
core/tests/Drupal/Tests/Core/Block/BlockBaseTest.php
+4
-4
core/tests/Drupal/Tests/UnitTestCase.php
core/tests/Drupal/Tests/UnitTestCase.php
+1
-1
No files found.
core/core.services.yml
View file @
7f2710be
...
...
@@ -274,6 +274,9 @@ services:
entity.form_builder
:
class
:
Drupal\Core\Entity\EntityFormBuilder
arguments
:
[
'
@entity.manager'
,
'
@form_builder'
]
plugin.manager.block
:
class
:
Drupal\Core\Block\BlockManager
parent
:
default_plugin_manager
plugin.manager.field.field_type
:
class
:
Drupal\Core\Field\FieldTypePluginManager
arguments
:
[
'
@container.namespaces'
,
'
@cache.discovery'
,
'
@module_handler'
]
...
...
core/
modules/block/src
/Annotation/Block.php
→
core/
lib/Drupal/Core/Block
/Annotation/Block.php
View file @
7f2710be
...
...
@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\
b
lock\Annotation\Block.
* Contains \Drupal\
Core\B
lock\Annotation\Block.
*/
namespace
Drupal\
b
lock\Annotation
;
namespace
Drupal\
Core\B
lock\Annotation
;
use
Drupal\Component\Annotation\Plugin
;
...
...
core/
modules/block/src
/BlockBase.php
→
core/
lib/Drupal/Core/Block
/BlockBase.php
View file @
7f2710be
...
...
@@ -2,11 +2,12 @@
/**
* @file
* Contains \Drupal\
b
lock\BlockBase.
* Contains \Drupal\
Core\B
lock\BlockBase.
*/
namespace
Drupal\
b
lock
;
namespace
Drupal\
Core\B
lock
;
use
Drupal\block\BlockInterface
;
use
Drupal\block\Event\BlockConditionContextEvent
;
use
Drupal\block\Event\BlockEvents
;
use
Drupal\Component\Plugin\ContextAwarePluginInterface
;
...
...
@@ -198,7 +199,7 @@ protected function blockAccess(AccountInterface $account) {
* BlockBase::blockForm(). Most block plugins should not override this
* method unless they need to alter the generic form elements.
*
* @see \Drupal\
b
lock\BlockBase::blockForm()
* @see \Drupal\
Core\B
lock\BlockBase::blockForm()
*/
public
function
buildConfigurationForm
(
array
$form
,
FormStateInterface
$form_state
)
{
$definition
=
$this
->
getPluginDefinition
();
...
...
@@ -335,7 +336,7 @@ public function blockForm($form, FormStateInterface $form_state) {
* Most block plugins should not override this method. To add validation
* for a specific block type, override BlockBase::blockValdiate().
*
* @see \Drupal\
b
lock\BlockBase::blockValidate()
* @see \Drupal\
Core\B
lock\BlockBase::blockValidate()
*/
public
function
validateConfigurationForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
// Remove the admin_label form item element value so it will not persist.
...
...
@@ -369,7 +370,7 @@ public function blockValidate($form, FormStateInterface $form_state) {}
* Most block plugins should not override this method. To add submission
* handling for a specific block type, override BlockBase::blockSubmit().
*
* @see \Drupal\
b
lock\BlockBase::blockSubmit()
* @see \Drupal\
Core\B
lock\BlockBase::blockSubmit()
*/
public
function
submitConfigurationForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
// Process the block's submission handling if no errors occurred only.
...
...
core/
modules/block/src
/BlockManager.php
→
core/
lib/Drupal/Core/Block
/BlockManager.php
View file @
7f2710be
...
...
@@ -2,16 +2,15 @@
/**
* @file
* Contains \Drupal\
b
lock\BlockManager.
* Contains \Drupal\
Core\B
lock\BlockManager.
*/
namespace
Drupal\
b
lock
;
namespace
Drupal\
Core\B
lock
;
use
Drupal\Core\Cache\CacheBackendInterface
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait
;
use
Drupal\Core\Plugin\DefaultPluginManager
;
use
Drupal\Core\StringTranslation\TranslationInterface
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
/**
...
...
@@ -19,7 +18,7 @@
*
* @todo Add documentation to this class.
*
* @see \Drupal\
b
lock\BlockPluginInterface
* @see \Drupal\
Core\B
lock\BlockPluginInterface
*/
class
BlockManager
extends
DefaultPluginManager
implements
BlockManagerInterface
{
...
...
@@ -34,7 +33,7 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface
protected
$moduleData
;
/**
* Constructs a new \Drupal\
b
lock\BlockManager object.
* Constructs a new \Drupal\
Core\B
lock\BlockManager object.
*
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
...
...
@@ -43,15 +42,12 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface
* Cache backend instance to use.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke the alter hook with.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The translation manager.
*/
public
function
__construct
(
\
Traversable
$namespaces
,
CacheBackendInterface
$cache_backend
,
ModuleHandlerInterface
$module_handler
,
TranslationInterface
$string_translation
)
{
parent
::
__construct
(
'Plugin/Block'
,
$namespaces
,
$module_handler
,
'Drupal\
b
lock\Annotation\Block'
);
public
function
__construct
(
\
Traversable
$namespaces
,
CacheBackendInterface
$cache_backend
,
ModuleHandlerInterface
$module_handler
)
{
parent
::
__construct
(
'Plugin/Block'
,
$namespaces
,
$module_handler
,
'Drupal\
Core\B
lock\Annotation\Block'
);
$this
->
alterInfo
(
'block'
);
$this
->
setCacheBackend
(
$cache_backend
,
'block_plugins'
);
$this
->
stringTranslation
=
$string_translation
;
}
/**
...
...
core/
modules/block/src
/BlockManagerInterface.php
→
core/
lib/Drupal/Core/Block
/BlockManagerInterface.php
View file @
7f2710be
...
...
@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\
b
lock\BlockManagerInterface.
* Contains \Drupal\
Core\B
lock\BlockManagerInterface.
*/
namespace
Drupal\
b
lock
;
namespace
Drupal\
Core\B
lock
;
use
Drupal\Core\Plugin\Context\ContextAwarePluginManagerInterface
;
...
...
core/
modules/block/src
/BlockPluginInterface.php
→
core/
lib/Drupal/Core/Block
/BlockPluginInterface.php
View file @
7f2710be
...
...
@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\
b
lock\BlockPluginInterface.
* Contains \Drupal\
Core\B
lock\BlockPluginInterface.
*/
namespace
Drupal\
b
lock
;
namespace
Drupal\
Core\B
lock
;
use
Drupal\Component\Plugin\Context\ContextInterface
;
use
Drupal\Component\Plugin\DerivativeInspectionInterface
;
...
...
@@ -109,8 +109,8 @@ public function blockForm($form, FormStateInterface $form_state);
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @see \Drupal\
b
lock\BlockPluginInterface::blockForm()
* @see \Drupal\
b
lock\BlockPluginInterface::blockSubmit()
* @see \Drupal\
Core\B
lock\BlockPluginInterface::blockForm()
* @see \Drupal\
Core\B
lock\BlockPluginInterface::blockSubmit()
*/
public
function
blockValidate
(
$form
,
FormStateInterface
$form_state
);
...
...
@@ -126,8 +126,8 @@ public function blockValidate($form, FormStateInterface $form_state);
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @see \Drupal\
b
lock\BlockPluginInterface::blockForm()
* @see \Drupal\
b
lock\BlockPluginInterface::blockValidate()
* @see \Drupal\
Core\B
lock\BlockPluginInterface::blockForm()
* @see \Drupal\
Core\B
lock\BlockPluginInterface::blockValidate()
*/
public
function
blockSubmit
(
$form
,
FormStateInterface
$form_state
);
...
...
core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php
View file @
7f2710be
...
...
@@ -131,4 +131,12 @@ public function getBaseThemes(array $themes, $theme);
*/
public
function
getName
(
$theme
);
/**
* Returns the default theme.
*
* @return string
* The default theme.
*/
public
function
getDefault
();
}
core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
View file @
7f2710be
...
...
@@ -10,7 +10,7 @@
use
Drupal\Component\Utility\NestedArray
;
use
Drupal\aggregator\FeedStorageInterface
;
use
Drupal\aggregator\ItemStorageInterface
;
use
Drupal\
b
lock\BlockBase
;
use
Drupal\
Core\B
lock\BlockBase
;
use
Drupal\Core\Entity\Query\QueryInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
...
...
core/modules/block/block.api.php
View file @
7f2710be
...
...
@@ -17,14 +17,14 @@
*
* To define a block in a module you need to:
* - Define a Block plugin by creating a new class that implements the
* \Drupal\
b
lock\BlockPluginInterface, in namespace Plugin\Block under your
* \Drupal\
Core\B
lock\BlockPluginInterface, in namespace Plugin\Block under your
* module namespace. For more information about creating plugins, see the
* @link plugin_api Plugin API topic. @endlink
* - Usually you will want to extend the \Drupal\
b
lock\BlockBase class, which
* - Usually you will want to extend the \Drupal\
Core\B
lock\BlockBase class, which
* provides a common configuration form and utility methods for getting and
* setting configuration in the block configuration entity.
* - Block plugins use the annotations defined by
* \Drupal\
b
lock\Annotation\Block. See the
* \Drupal\
Core\B
lock\Annotation\Block. See the
* @link annotation Annotations topic @endlink for more information about
* annotations.
*
...
...
@@ -61,7 +61,7 @@
*/
/**
* Alter the result of \Drupal\
b
lock\BlockBase::build().
* Alter the result of \Drupal\
Core\B
lock\BlockBase::build().
*
* This hook is called after the content has been assembled in a structured
* array and may be used for doing processing which requires that the complete
...
...
@@ -81,7 +81,7 @@
* A renderable array of data, as returned from the build() implementation of
* the plugin that defined the block:
* - #title: The default localized title of the block.
* @param \Drupal\
b
lock\BlockPluginInterface $block
* @param \Drupal\
Core\B
lock\BlockPluginInterface $block
* The block plugin instance.
*
* @see hook_block_view_BASE_BLOCK_ID_alter()
...
...
@@ -89,7 +89,7 @@
*
* @ingroup block_api
*/
function
hook_block_view_alter
(
array
&
$build
,
\
Drupal\
b
lock\BlockPluginInterface
$block
)
{
function
hook_block_view_alter
(
array
&
$build
,
\
Drupal\
Core\B
lock\BlockPluginInterface
$block
)
{
// Remove the contextual links on all blocks that provide them.
if
(
isset
(
$build
[
'#contextual_links'
]))
{
unset
(
$build
[
'#contextual_links'
]);
...
...
@@ -111,7 +111,7 @@ function hook_block_view_alter(array &$build, \Drupal\block\BlockPluginInterface
* A renderable array of data, as returned from the build() implementation of
* the plugin that defined the block:
* - #title: The default localized title of the block.
* @param \Drupal\
b
lock\BlockPluginInterface $block
* @param \Drupal\
Core\B
lock\BlockPluginInterface $block
* The block plugin instance.
*
* @see hook_block_view_alter()
...
...
@@ -119,7 +119,7 @@ function hook_block_view_alter(array &$build, \Drupal\block\BlockPluginInterface
*
* @ingroup block_api
*/
function
hook_block_view_BASE_BLOCK_ID_alter
(
array
&
$build
,
\
Drupal\
b
lock\BlockPluginInterface
$block
)
{
function
hook_block_view_BASE_BLOCK_ID_alter
(
array
&
$build
,
\
Drupal\
Core\B
lock\BlockPluginInterface
$block
)
{
// Change the title of the specific block.
$build
[
'#title'
]
=
t
(
'New title of the block'
);
}
...
...
core/modules/block/block.services.yml
View file @
7f2710be
services
:
plugin.manager.block
:
class
:
Drupal\block\BlockManager
arguments
:
[
'
@container.namespaces'
,
'
@cache.discovery'
,
'
@module_handler'
,
'
@string_translation'
]
theme.negotiator.block.admin_demo
:
class
:
Drupal\block\Theme\AdminDemoNegotiator
tags
:
...
...
core/modules/block/src/BlockInterface.php
View file @
7f2710be
...
...
@@ -27,7 +27,7 @@ interface BlockInterface extends ConfigEntityInterface {
/**
* Returns the plugin instance.
*
* @return \Drupal\
b
lock\BlockPluginInterface
* @return \Drupal\
Core\B
lock\BlockPluginInterface
* The plugin instance for this block.
*/
public
function
getPlugin
();
...
...
core/modules/block/src/BlockListBuilder.php
View file @
7f2710be
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\block
;
use
Drupal\
b
lock\BlockManagerInterface
;
use
Drupal\
Core\B
lock\BlockManagerInterface
;
use
Drupal\Component\Serialization\Json
;
use
Drupal\Component\Utility\String
;
use
Drupal\Core\Config\Entity\ConfigEntityListBuilder
;
...
...
@@ -50,7 +50,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
/**
* The block manager.
*
* @var \Drupal\
b
lock\BlockManagerInterface
* @var \Drupal\
Core\B
lock\BlockManagerInterface
*/
protected
$blockManager
;
...
...
@@ -61,7 +61,7 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
* The entity type definition.
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
* The entity storage class.
* @param \Drupal\
b
lock\BlockManagerInterface $block_manager
* @param \Drupal\
Core\B
lock\BlockManagerInterface $block_manager
* The block manager.
*/
public
function
__construct
(
EntityTypeInterface
$entity_type
,
EntityStorageInterface
$storage
,
BlockManagerInterface
$block_manager
)
{
...
...
core/modules/block/src/BlockPluginBag.php
View file @
7f2710be
...
...
@@ -45,7 +45,7 @@ public function __construct(PluginManagerInterface $manager, $instance_id, array
/**
* {@inheritdoc}
*
* @return \Drupal\
b
lock\BlockPluginInterface
* @return \Drupal\
Core\B
lock\BlockPluginInterface
*/
public
function
&
get
(
$instance_id
)
{
return
parent
::
get
(
$instance_id
);
...
...
core/modules/block/src/Controller/CategoryAutocompleteController.php
View file @
7f2710be
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\block\Controller
;
use
Drupal\
b
lock\BlockManagerInterface
;
use
Drupal\
Core\B
lock\BlockManagerInterface
;
use
Drupal\Component\Utility\String
;
use
Drupal\Core\DependencyInjection\ContainerInjectionInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -22,14 +22,14 @@ class CategoryAutocompleteController implements ContainerInjectionInterface {
/**
* The block manager.
*
* @var \Drupal\
b
lock\BlockManagerInterface
* @var \Drupal\
Core\B
lock\BlockManagerInterface
*/
protected
$blockManager
;
/**
* Constructs a new CategoryAutocompleteController.
*
* @param \Drupal\
b
lock\BlockManagerInterface $block_manager
* @param \Drupal\
Core\B
lock\BlockManagerInterface $block_manager
* The block manager.
*/
public
function
__construct
(
BlockManagerInterface
$block_manager
)
{
...
...
core/modules/block/src/Event/BlockConditionContextEvent.php
View file @
7f2710be
...
...
@@ -30,7 +30,7 @@ public function __construct(ConditionPluginBag $conditions) {
}
/**
* @return \Drupal\
b
lock\BlockPluginInterface
* @return \Drupal\
Core\B
lock\BlockPluginInterface
*/
public
function
getConditions
()
{
return
$this
->
conditions
;
...
...
core/modules/block/src/Event/BlockEvents.php
View file @
7f2710be
...
...
@@ -15,7 +15,7 @@ final class BlockEvents {
/**
* Name of the event when gathering condition context for a block plugin.
*
* @see \Drupal\
b
lock\BlockBase::getConditionContexts()
* @see \Drupal\
Core\B
lock\BlockBase::getConditionContexts()
* @see \Drupal\block\Event\BlockConditionContextEvent
*/
const
CONDITION_CONTEXT
=
'block.condition_context'
;
...
...
core/modules/block/src/Tests/BlockConfigSchemaTest.php
View file @
7f2710be
...
...
@@ -47,7 +47,7 @@ class BlockConfigSchemaTest extends KernelTestBase {
/**
* The block manager.
*
* @var \Drupal\
b
lock\BlockManagerInterface
* @var \Drupal\
Core\B
lock\BlockManagerInterface
*/
protected
$blockManager
;
...
...
core/modules/block/src/Tests/BlockInterfaceTest.php
View file @
7f2710be
...
...
@@ -51,7 +51,7 @@ public function testBlockInterface() {
'display_message'
=>
'no message set'
,
);
// Initial configuration of the block at construction time.
/** @var $display_block \Drupal\
b
lock\BlockPluginInterface */
/** @var $display_block \Drupal\
Core\B
lock\BlockPluginInterface */
$display_block
=
$manager
->
createInstance
(
'test_block_instantiation'
,
$configuration
);
$this
->
assertIdentical
(
$display_block
->
getConfiguration
(),
$expected_configuration
,
'The block was configured correctly.'
);
...
...
core/modules/block/tests/modules/block_test/block_test.module
View file @
7f2710be
...
...
@@ -5,7 +5,7 @@
* Provide test blocks.
*/
use
Drupal\
b
lock\BlockPluginInterface
;
use
Drupal\
Core\B
lock\BlockPluginInterface
;
/**
* Implements hook_block_alter().
...
...
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php
View file @
7f2710be
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\block_test\Plugin\Block
;
use
Drupal\
b
lock\BlockBase
;
use
Drupal\
Core\B
lock\BlockBase
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Session\AccountInterface
;
...
...
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php
View file @
7f2710be
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\block_test\Plugin\Block
;
use
Drupal\
b
lock\BlockBase
;
use
Drupal\
Core\B
lock\BlockBase
;
/**
* Provides a block to test caching.
...
...
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
View file @
7f2710be
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\block_test\Plugin\Block
;
use
Drupal\
b
lock\BlockBase
;
use
Drupal\
Core\B
lock\BlockBase
;
/**
* Provides a context-aware block.
...
...
core/modules/block/tests/modules/block_test/src/Plugin/Block/TestHtmlBlock.php
View file @
7f2710be
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\block_test\Plugin\Block
;
use
Drupal\
b
lock\BlockBase
;
use
Drupal\
Core\B
lock\BlockBase
;
/**
* Provides a block to test HTML.
...
...
core/modules/block/tests/src/CategoryAutocompleteTest.php
View file @
7f2710be
...
...
@@ -26,7 +26,7 @@ class CategoryAutocompleteTest extends UnitTestCase {
protected
$autocompleteController
;
protected
function
setUp
()
{
$block_manager
=
$this
->
getMock
(
'Drupal\
b
lock\BlockManagerInterface'
);
$block_manager
=
$this
->
getMock
(
'Drupal\
Core\B
lock\BlockManagerInterface'
);
$block_manager
->
expects
(
$this
->
any
())
->
method
(
'getCategories'
)
->
will
(
$this
->
returnValue
(
array
(
'Comment'
,
'Node'
,
'None & Such'
,
'User'
)));
...
...
core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
View file @
7f2710be
...
...
@@ -7,8 +7,8 @@
namespace
Drupal\block_content\Plugin\Block
;
use
Drupal\
b
lock\BlockBase
;
use
Drupal\
b
lock\BlockManagerInterface
;
use
Drupal\
Core\B
lock\BlockBase
;
use
Drupal\
Core\B
lock\BlockManagerInterface
;
use
Drupal\Core\Entity\EntityManager
;
use
Drupal\Core\Entity\EntityManagerInterface
;
use
Drupal\Core\Form\FormStateInterface
;
...
...
@@ -32,7 +32,7 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
/**
* The Plugin Block Manager.
*
* @var \Drupal\
b
lock\BlockManagerInterface.
* @var \Drupal\
Core\B
lock\BlockManagerInterface.
*/
protected
$blockManager
;
...
...
@@ -66,7 +66,7 @@ class BlockContentBlock extends BlockBase implements ContainerFactoryPluginInter
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\
b
lock\BlockManagerInterface
* @param \Drupal\
Core\B
lock\BlockManagerInterface
* The Plugin Block Manager.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager service.
...
...
@@ -117,7 +117,7 @@ public function defaultConfiguration() {
}
/**
* Overrides \Drupal\
b
lock\BlockBase::blockForm().
* Overrides \Drupal\
Core\B
lock\BlockBase::blockForm().
*
* Adds body and description fields to the block configuration form.
*/
...
...
core/modules/book/src/Plugin/Block/BookNavigationBlock.php
View file @
7f2710be
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\book\Plugin\Block
;
use
Drupal\
b
lock\BlockBase
;
use
Drupal\
Core\B
lock\BlockBase
;
use
Drupal\book\BookManagerInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
...
...
core/modules/forum/src/Plugin/Block/ForumBlockBase.php
View file @
7f2710be
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\forum\Plugin\Block
;
use
Drupal\
b
lock\BlockBase
;
use
Drupal\
Core\B
lock\BlockBase
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Cache\Cache
;
...
...
core/modules/language/language.admin.inc
View file @
7f2710be
...
...
@@ -203,21 +203,3 @@ function template_preprocess_language_content_settings_table(&$variables) {
function
theme_language_content_settings_table
(
$variables
)
{
return
'<h4>'
.
$variables
[
'build'
][
'#title'
]
.
'</h4>'
.
drupal_render
(
$variables
[
'build'
]);
}
/**
* Helper function to disable the language switcher blocks.
*
* @param array $language_types
* Array containing all language types whose language switchers need to be
* disabled.
*/
function
_language_disable_language_switcher
(
array
$language_types
)
{
$blocks
=
_block_rehash
();
foreach
(
$language_types
as
$language_type
)
{
foreach
(
$blocks
as
$block
)
{
if
(
strpos
(
$block
->
id
,
'language_switcher_'
.
substr
(
$language_type
,
9
))
!==
FALSE
)
{
$block
->
delete
();
}
}
}
}
core/modules/language/src/Form/NegotiationConfigureForm.php
View file @
7f2710be
...
...
@@ -7,12 +7,13 @@
namespace
Drupal\language\Form
;
use
Drupal\
b
lock\BlockManagerInterface
;
use
Drupal\
Core\B
lock\BlockManagerInterface
;
use
Drupal\Component\Utility\String
;
use
Drupal\Component\Utility\Unicode
;
use
Drupal\Component\Utility\Xss
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\Core\Entity\EntityStorageInterface
;
use
Drupal\Core\Extension\ThemeHandlerInterface
;
use
Drupal\Core\Form\FormBase
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\language\ConfigurableLanguageManagerInterface
;
...
...
@@ -49,10 +50,24 @@ class NegotiationConfigureForm extends FormBase {
/**
* The block manager.
*
* @var \Drupal\
b
lock\BlockManagerInterface
* @var \Drupal\
Core\B
lock\BlockManagerInterface
*/
protected
$blockManager
;
/**
* The block storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface|null
*/
protected
$blockStorage
;
/**
* The theme handler.
*
* @var \Drupal\Core\Extension\ThemeHandlerInterface
*/
protected
$themeHandler
;
/**
* Constructs a NegotiationConfigureForm object.
*
...
...
@@ -62,25 +77,35 @@ class NegotiationConfigureForm extends FormBase {
* The language manager.
* @param \Drupal\language\LanguageNegotiatorInterface $negotiator
* The language negotiation methods manager.
* @param \Drupal\block\BlockManagerInterface $block_manager
* The block manager, or NULL if not available.
* @param \Drupal\Core\Block\BlockManagerInterface $block_manager
* The block manager.
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler.
* @param \Drupal\Core\Entity\EntityStorageInterface $block_storage
* The block storage, or NULL if not available.
*/
public
function
__construct
(
ConfigFactoryInterface
$config_factory
,
ConfigurableLanguageManagerInterface
$language_manager
,
LanguageNegotiatorInterface
$negotiator
,
BlockManagerInterface
$block_manager
=
NULL
)
{
public
function
__construct
(
ConfigFactoryInterface
$config_factory
,
ConfigurableLanguageManagerInterface
$language_manager
,
LanguageNegotiatorInterface
$negotiator
,
BlockManagerInterface
$block_manager
,
ThemeHandlerInterface
$theme_handler
,
EntityStorageInterface
$block_storage
=
NULL
)
{
$this
->
languageTypes
=
$config_factory
->
get
(
'language.types'
);
$this
->
languageManager
=
$language_manager
;
$this
->
negotiator
=
$negotiator
;
$this
->
blockManager
=
$block_manager
;
$this
->
themeHandler
=
$theme_handler
;
$this
->
blockStorage
=
$block_storage
;
}
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
)
{
$entity_manager
=
$container
->
get
(
'entity.manager'
);
$block_storage
=
$entity_manager
->
hasController
(
'block'
,
'storage'
)
?
$entity_manager
->
getStorage
(
'block'
)
:
NULL
;
return
new
static
(
$container
->
get
(
'config.factory'
),
$container
->
get
(
'language_manager'
),
$container
->
get
(
'language_negotiator'
),
$container
->
has
(
'plugin.manager.block'
)
?
$container
->
get
(
'plugin.manager.block'
)
:
NULL
$container
->
get
(
'plugin.manager.block'
),
$container
->
get
(
'theme_handler'
),
$block_storage
);
}
...
...
@@ -152,7 +177,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
}
$method_weights_type
[
$type
]
=
$method_weights
;
$this
->
config
(
'language.types'
)
->
set
(
'negotiation.'
.
$type
.
'.method_weights'
,
$method_weights_input
)
->
save
();
$this
->
languageTypes
->
set
(
'negotiation.'
.
$type
.
'.method_weights'
,
$method_weights_input
)
->
save
();
}
// Update non-configurable language types and the related language
...
...
@@ -166,13 +191,13 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// Clear block definitions cache since the available blocks and their names
// may have been changed based on the configurable types.
if
(
$this
->
block
Manager
)
{
if
(
$this
->
block
Storage
)
{
// If there is an active language switcher for a language type that has
// been made not configurable, deactivate it first.
$non_configurable
=
array_keys
(
array_diff
(
$customized
,
array_filter
(
$customized
)));
$this
->
disableLanguageSwitcher
(
$non_configurable
);
$this
->
blockManager
->
clearCachedDefinitions
();
}
$this
->
blockManager
->
clearCachedDefinitions
();
$form_state
->
setRedirect
(
'language.negotiation'
);
drupal_set_message
(
$this
->
t
(
'Language negotiation configuration saved.'
));
...
...
@@ -214,8 +239,8 @@ protected function configureFormTable(array &$form, $type) {
}