|
8 | 8 | use Drupal\Component\Utility\Xss; |
9 | 9 | use Drupal\Core\Ajax\AjaxResponse; |
10 | 10 | use Drupal\Core\Ajax\ReplaceCommand; |
| 11 | +use Drupal\Core\Block\Attribute\Block; |
11 | 12 | use Drupal\Core\Block\BlockBase; |
12 | 13 | use Drupal\Core\Block\BlockManagerInterface; |
13 | 14 | use Drupal\Core\Entity\EntityStorageException; |
|
19 | 20 | use Drupal\Core\Plugin\Context\ContextHandlerInterface; |
20 | 21 | use Drupal\Core\Plugin\Context\ContextRepositoryInterface; |
21 | 22 | use Drupal\Core\Render\BubbleableMetadata; |
| 23 | +use Drupal\Core\StringTranslation\TranslatableMarkup; |
22 | 24 | use Drupal\Core\Utility\Token; |
23 | 25 | use Drupal\patternkit\Entity\PatternInterface; |
24 | 26 | use Drupal\patternkit\Entity\PatternkitBlock as EntityPatternkitBlock; |
|
38 | 40 | /** |
39 | 41 | * Provides a block that will display a Pattern from a Library with context. |
40 | 42 | * |
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 | | - * |
48 | 43 | * @todo Remove JSON Serializer dependencies from this class so the editor |
49 | 44 | * operates off of the pattern library plugin instead. |
50 | 45 | */ |
| 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 | +)] |
51 | 52 | class PatternkitBlock extends BlockBase implements ContainerFactoryPluginInterface, PatternkitEnvironmentAwareInterface { |
52 | 53 |
|
53 | 54 | use PatternkitEnvironmentAwareTrait; |
|
0 commit comments