Skip to content

Commit c2f939e

Browse files
author
Stephen Lucero
committed
Issue #3480641 by slucero, petermallett: Convert Block Plugins to Use Attributes
1 parent e80da4d commit c2f939e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎src/Plugin/Block/PatternkitBlock.php‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Drupal\Component\Utility\Xss;
99
use Drupal\Core\Ajax\AjaxResponse;
1010
use Drupal\Core\Ajax\ReplaceCommand;
11+
use Drupal\Core\Block\Attribute\Block;
1112
use Drupal\Core\Block\BlockBase;
1213
use Drupal\Core\Block\BlockManagerInterface;
1314
use Drupal\Core\Entity\EntityStorageException;
@@ -19,6 +20,7 @@
1920
use Drupal\Core\Plugin\Context\ContextHandlerInterface;
2021
use Drupal\Core\Plugin\Context\ContextRepositoryInterface;
2122
use Drupal\Core\Render\BubbleableMetadata;
23+
use Drupal\Core\StringTranslation\TranslatableMarkup;
2224
use Drupal\Core\Utility\Token;
2325
use Drupal\patternkit\Entity\PatternInterface;
2426
use Drupal\patternkit\Entity\PatternkitBlock as EntityPatternkitBlock;
@@ -38,16 +40,15 @@
3840
/**
3941
* Provides a block that will display a Pattern from a Library with context.
4042
*
41-
* @Block(
42-
* id = "patternkit_block",
43-
* admin_label = @Translation("Patternkit block"),
44-
* category = "Patternkit Reusable",
45-
* deriver = "Drupal\patternkit\Plugin\Derivative\PatternkitBlock"
46-
* )
47-
*
4843
* @todo Remove JSON Serializer dependencies from this class so the editor
4944
* operates off of the pattern library plugin instead.
5045
*/
46+
#[Block(
47+
id: 'patternkit_block',
48+
admin_label: new TranslatableMarkup('Patternkit block'),
49+
category: new TranslatableMarkup('Pattternkit Reusable'),
50+
deriver: 'Drupal\patternkit\Plugin\Derivative\PatternkitBlock'
51+
)]
5152
class PatternkitBlock extends BlockBase implements ContainerFactoryPluginInterface, PatternkitEnvironmentAwareInterface {
5253

5354
use PatternkitEnvironmentAwareTrait;

0 commit comments

Comments
 (0)