File tree Expand file tree Collapse file tree 3 files changed +21
-18
lines changed
tests/functional/Generator/Plugin/_block
_n_deps/_n_config/src/Plugin/Block
_w_deps/_w_config/src/Plugin/Block Expand file tree Collapse file tree 3 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ namespace Drupal\{{ machine_name }}\Plugin\Block;
1010use Drupal\Core\Access\AccessResult ;
1111use Drupal\Core\Session\AccountInterface ;
1212 {% endif % }
13+ use Drupal\Core\Block\Attribute\Block ;
1314use Drupal\Core\Block\BlockBase ;
15+ use Drupal\Core\StringTranslation\TranslatableMarkup ;
1416 {% if configurable % }
1517use Drupal\Core\Form\FormStateInterface ;
1618 {% endif % }
@@ -23,13 +25,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
2325
2426/**
2527 * Provides {{ plugin_label|article|lower }} block.
26- *
27- * @Block(
28- * id = "{{ plugin_id }}",
29- * admin_label = @Translation("{{ plugin_label }}"),
30- * category = @Translation("{{ category }}"),
31- * )
3228 */
29+ # [Block(
30+ id : ' {{ plugin_id }}' ,
31+ admin_label : new TranslatableMarkup (' {{ plugin_label }}' ),
32+ category : new TranslatableMarkup (' {{ category }}' ),
33+ )]
3334final class {{ class }} extends BlockBase {% if services % }implements ContainerFactoryPluginInterface {% endif % }{
3435
3536{% if services % }
Original file line number Diff line number Diff line change 44
55namespace Drupal \foo \Plugin \Block ;
66
7+ use Drupal \Core \Block \Attribute \Block ;
78use Drupal \Core \Block \BlockBase ;
9+ use Drupal \Core \StringTranslation \TranslatableMarkup ;
810
911/**
1012 * Provides an example block.
11- *
12- * @Block(
13- * id = "foo_example",
14- * admin_label = @Translation("Example"),
15- * category = @Translation("Custom"),
16- * )
1713 */
14+ #[Block(
15+ id: 'foo_example ' ,
16+ admin_label: new TranslatableMarkup ('Example ' ),
17+ category: new TranslatableMarkup ('Custom ' ),
18+ )]
1819final class ExampleBlock extends BlockBase {
1920
2021 /**
Original file line number Diff line number Diff line change 55namespace Drupal \foo \Plugin \Block ;
66
77use Drupal \Core \Access \AccessResult ;
8+ use Drupal \Core \Block \Attribute \Block ;
89use Drupal \Core \Block \BlockBase ;
910use Drupal \Core \CronInterface ;
1011use Drupal \Core \Form \FormStateInterface ;
1112use Drupal \Core \Plugin \ContainerFactoryPluginInterface ;
1213use Drupal \Core \Session \AccountInterface ;
14+ use Drupal \Core \StringTranslation \TranslatableMarkup ;
1315use Symfony \Component \DependencyInjection \ContainerInterface ;
1416
1517/**
1618 * Provides an example block.
17- *
18- * @Block(
19- * id = "foo_example",
20- * admin_label = @Translation("Example"),
21- * category = @Translation("Custom"),
22- * )
2319 */
20+ #[Block(
21+ id: 'foo_example ' ,
22+ admin_label: new TranslatableMarkup ('Example ' ),
23+ category: new TranslatableMarkup ('Custom ' ),
24+ )]
2425final class ExampleBlock extends BlockBase implements ContainerFactoryPluginInterface {
2526
2627 /**
You can’t perform that action at this time.
0 commit comments