Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
0489b631
Commit
0489b631
authored
Aug 25, 2013
by
alexpott
Browse files
Issue
#2065721
by tim.plunkett: Add a dedicated @Block plugin annotation.
parent
703e9e47
Changes
30
Hide whitespace changes
Inline
Side-by-side
core/modules/aggregator/lib/Drupal/aggregator/Plugin/Block/AggregatorCategoryBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\aggregator\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides an 'Aggregator category' block for the latest items in a category.
*
* @
Plugin
(
* @
Block
(
* id = "aggregator_category_block",
* admin_label = @Translation("Aggregator category"),
* module = "aggregator",
* derivative = "Drupal\aggregator\Plugin\Derivative\AggregatorCategoryBlock"
* )
*/
...
...
core/modules/aggregator/lib/Drupal/aggregator/Plugin/Block/AggregatorFeedBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\aggregator\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides an 'Aggregator feed' block with the latest items from the feed.
*
* @
Plugin
(
* @
Block
(
* id = "aggregator_feed_block",
* admin_label = @Translation("Aggregator feed"),
* module = "aggregator",
* derivative = "Drupal\aggregator\Plugin\Derivative\AggregatorFeedBlock"
* )
*/
...
...
core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php
View file @
0489b631
...
...
@@ -8,7 +8,7 @@
namespace
Drupal\custom_block\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
...
...
@@ -18,10 +18,9 @@
/**
* Defines a generic custom block type.
*
* @
Plugin
(
* @
Block
(
* id = "custom_block",
* admin_label = @Translation("Custom block"),
* module = "custom_block",
* derivative = "Drupal\custom_block\Plugin\Derivative\CustomBlock"
* )
*/
...
...
core/modules/block/lib/Drupal/block/Annotation/Block.php
0 → 100644
View file @
0489b631
<?php
/**
* @file
* Contains \Drupal\block\Annotation\Block.
*/
namespace
Drupal\block\Annotation
;
use
Drupal\Component\Annotation\Plugin
;
/**
* Defines a Block annotation object.
*
* @Annotation
*/
class
Block
extends
Plugin
{
/**
* The plugin ID.
*
* @var string
*/
public
$id
;
/**
* The administrative label of the block.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public
$admin_label
;
}
core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php
View file @
0489b631
...
...
@@ -35,7 +35,8 @@ class BlockManager extends DefaultPluginManager {
* The module handler to invoke the alter hook with.
*/
public
function
__construct
(
\
Traversable
$namespaces
,
CacheBackendInterface
$cache_backend
,
LanguageManager
$language_manager
,
ModuleHandlerInterface
$module_handler
)
{
parent
::
__construct
(
'Plugin/Block'
,
$namespaces
);
$annotation_namespaces
=
array
(
'Drupal\block\Annotation'
=>
$namespaces
[
'Drupal\block'
]);
parent
::
__construct
(
'Plugin/Block'
,
$namespaces
,
$annotation_namespaces
,
'Drupal\block\Annotation\Block'
);
$this
->
alterInfo
(
$module_handler
,
'block'
);
$this
->
setCacheBackend
(
$cache_backend
,
$language_manager
,
'block_plugins'
);
}
...
...
@@ -48,6 +49,7 @@ public function processDefinition(&$definition, $plugin_id) {
// Ensure that every block has a category.
$definition
+=
array
(
'module'
=>
$definition
[
'provider'
],
'category'
=>
$definition
[
'provider'
],
);
}
...
...
core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\block_test\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a basic block for testing block instantiation and configuration.
*
* @
Plugin
(
* @
Block
(
* id = "test_block_instantiation",
* admin_label = @Translation("Display message"),
* module = "block_test"
* admin_label = @Translation("Display message")
* )
*/
class
TestBlockInstantiation
extends
BlockBase
{
...
...
core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\block_test\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a block to test caching.
*
* @
Plugin
(
* @
Block
(
* id = "test_cache",
* admin_label = @Translation("Test block caching"),
* module = "block_test"
* admin_label = @Translation("Test block caching")
* )
*/
class
TestCacheBlock
extends
BlockBase
{
...
...
core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestHtmlIdBlock.php
View file @
0489b631
...
...
@@ -7,17 +7,15 @@
namespace
Drupal\block_test\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\Component\Annotation\Plugin
;
use
Drupal\block\Annotation\Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a block to test HTML IDs.
*
* @
Plugin
(
* @
Block
(
* id = "test_html_id",
* admin_label = @Translation("Test block html id"),
* module = "block_test"
* admin_label = @Translation("Test block html id")
* )
*/
class
TestHtmlIdBlock
extends
TestCacheBlock
{
...
...
core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestXSSTitleBlock.php
View file @
0489b631
...
...
@@ -7,15 +7,14 @@
namespace
Drupal\block_test\Plugin\Block
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
/**
* Provides a block to test XSS in title.
*
* @
Plugin
(
* @
Block
(
* id = "test_xss_title",
* admin_label = "<script>alert('XSS subject');</script>",
* module = "block_test"
* admin_label = "<script>alert('XSS subject');</script>"
* )
*/
class
TestXSSTitleBlock
extends
TestCacheBlock
{
...
...
core/modules/book/lib/Drupal/book/Plugin/Block/BookNavigationBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\book\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a 'Book navigation' block.
*
* @
Plugin
(
* @
Block
(
* id = "book_navigation",
* admin_label = @Translation("Book navigation"),
* module = "book"
* admin_label = @Translation("Book navigation")
* )
*/
class
BookNavigationBlock
extends
BlockBase
{
...
...
core/modules/comment/lib/Drupal/comment/Plugin/Block/RecentCommentsBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\comment\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a 'Recent comments' block.
*
* @
Plugin
(
* @
Block
(
* id = "recent_comments",
* admin_label = @Translation("Recent comments"),
* module = "comment"
* admin_label = @Translation("Recent comments")
* )
*/
class
RecentCommentsBlock
extends
BlockBase
{
...
...
core/modules/forum/lib/Drupal/forum/Plugin/Block/ActiveTopicsBlock.php
View file @
0489b631
...
...
@@ -7,16 +7,15 @@
namespace
Drupal\forum\Plugin\Block
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides an 'Active forum topics' block.
*
* @
Plugin
(
* @
Block
(
* id = "forum_active_block",
* admin_label = @Translation("Active forum topics"),
* module = "forum"
* admin_label = @Translation("Active forum topics")
* )
*/
class
ActiveTopicsBlock
extends
ForumBlockBase
{
...
...
core/modules/forum/lib/Drupal/forum/Plugin/Block/NewTopicsBlock.php
View file @
0489b631
...
...
@@ -7,16 +7,15 @@
namespace
Drupal\forum\Plugin\Block
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a 'New forum topics' block.
*
* @
Plugin
(
* @
Block
(
* id = "forum_new_block",
* admin_label = @Translation("New forum topics"),
* module = "forum"
* admin_label = @Translation("New forum topics")
* )
*/
class
NewTopicsBlock
extends
ForumBlockBase
{
...
...
core/modules/language/lib/Drupal/language/Plugin/Block/LanguageBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\language\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a 'Language switcher' block.
*
* @
Plugin
(
* @
Block
(
* id = "language_block",
* admin_label = @Translation("Language switcher"),
* module = "language",
* derivative = "Drupal\language\Plugin\Derivative\LanguageBlock"
* )
*/
...
...
core/modules/menu/lib/Drupal/menu/Plugin/Block/MenuBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\menu\Plugin\Block
;
use
Drupal\system\Plugin\Block\SystemMenuBlock
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a generic Menu block.
*
* @
Plugin
(
* @
Block
(
* id = "menu_menu_block",
* admin_label = @Translation("Menu"),
* module = "menu",
* derivative = "Drupal\menu\Plugin\Derivative\MenuBlock"
* )
*/
...
...
core/modules/node/lib/Drupal/node/Plugin/Block/RecentContentBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\node\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a 'Recent content' block.
*
* @
Plugin
(
* @
Block
(
* id = "node_recent_block",
* admin_label = @Translation("Recent content"),
* module = "node"
* admin_label = @Translation("Recent content")
* )
*/
class
RecentContentBlock
extends
BlockBase
{
...
...
core/modules/node/lib/Drupal/node/Plugin/Block/SyndicateBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\node\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a 'Syndicate' block that links to the site's RSS feed.
*
* @
Plugin
(
* @
Block
(
* id = "node_syndicate_block",
* admin_label = @Translation("Syndicate"),
* module = "node"
* admin_label = @Translation("Syndicate")
* )
*/
class
SyndicateBlock
extends
BlockBase
{
...
...
core/modules/search/lib/Drupal/search/Plugin/Block/SearchBlock.php
View file @
0489b631
...
...
@@ -8,7 +8,7 @@
namespace
Drupal\search\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Drupal\search\Form\SearchBlockForm
;
...
...
@@ -18,10 +18,9 @@
/**
* Provides a 'Search form' block.
*
* @
Plugin
(
* @
Block
(
* id = "search_form_block",
* admin_label = @Translation("Search form"),
* module = "search"
* admin_label = @Translation("Search form")
* )
*/
class
SearchBlock
extends
BlockBase
implements
ContainerFactoryPluginInterface
{
...
...
core/modules/shortcut/lib/Drupal/shortcut/Plugin/Block/ShortcutsBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\shortcut\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a 'Shortcut' block.
*
* @
Plugin
(
* @
Block
(
* id = "shortcuts",
* admin_label = @Translation("Shortcuts"),
* module = "shortcut"
* admin_label = @Translation("Shortcuts")
* )
*/
class
ShortcutsBlock
extends
BlockBase
{
...
...
core/modules/statistics/lib/Drupal/statistics/Plugin/Block/StatisticsPopularBlock.php
View file @
0489b631
...
...
@@ -8,16 +8,15 @@
namespace
Drupal\statistics\Plugin\Block
;
use
Drupal\block\BlockBase
;
use
Drupal\
Component
\Annotation\
Plugin
;
use
Drupal\
block
\Annotation\
Block
;
use
Drupal\Core\Annotation\Translation
;
/**
* Provides a 'Popular content' block.
*
* @
Plugin
(
* @
Block
(
* id = "statistics_popular_block",
* admin_label = @Translation("Popular content"),
* module = "statistics"
* admin_label = @Translation("Popular content")
* )
*/
class
StatisticsPopularBlock
extends
BlockBase
{
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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