Drupal 9 Symfony

Posted : admin On 1/25/2022

Yet, Symfony is just the beginning, as what Drupal has done on top of Symfony is equally brilliant. From the get-go, Drupal 9 anticipates that you will be building something big and establishes a clean system of organization for your views, models, controllers, routes, services, listeners, etc. Drupal 9 brings forward all the features from Drupal 8 and carries on its continuous innovation with new features twice a year. Bringing the best of open source together Drupal incorporates the best supporting technologies from the open source ecosystem. Composer, Symfony, Twig, PHPUnit and more will be familiar to many. 9.0.x vendor/symfony/console/Helper/ProgressIndicator.php SymfonyComponentConsoleHelperProgressIndicator::startTime; 9.2.x vendor/symfony/console/Helper.

  1. Drupal 9 Symfony
  2. Drupal 9 Symfony Framework Classes
  3. Drupal 9 Symfony 5

Create the block class file /web/modules/custom/my_module/src/Plugin/Block/HelloBlock.php and add the code below.

Drupal 9 Symfony
2
4
6
8
10
12
* Implements hook_preprocess().
</em>functionmy_module_preprocess(&amp;$variables,$hook){
$block_manager=Drupal::<em>service</em>('plugin.manager.block');
$block_plugin=$block_manager->createInstance('<code>hello_block</code>',$block_config);
$variables['<code>hello_block</code>_output']=render($block_build);
Symfony

Drupal 9 Symfony Framework Classes

Then into our template file we display the variable

Drupal 9 Symfony 5

don’t forget to execute : vendor/bin/drush cr