O'Reilly logo

Drupal 8 Module Development by Daniel Sipos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Our first block plugin

So, this is our plugin class--HelloWorldSalutationBlock--that does just that:

namespace Drupal\hello_world\Plugin\Block;use Drupal\Core\Block\BlockBase;use Drupal\Core\Plugin\ContainerFactoryPluginInterface;use Symfony\Component\DependencyInjection\ContainerInterface;use Drupal\hello_world\HelloWorldSalutation as HelloWorldSalutationService;/** * Hello World Salutation block. * * @Block( *  id = "hello_world_salutation_block", *  admin_label = @Translation("Hello world salutation"), * ) */class HelloWorldSalutationBlock extends BlockBase implements ContainerFactoryPluginInterface {  /**   * Drupal\hello_world\HelloWorldSalutation definition.   *   * @var \Drupal\hello_world\HelloWorldSalutation   */  protected $salutation; /** ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required