SendinblueBlock.php in SendinBlue 8
File
src/Plugin/Block/SendinblueBlock.php
View source
<?php
namespace Drupal\sendinblue\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\sendinblue\Form\SubscribeForm;
use Symfony\Component\DependencyInjection\ContainerInterface;
class SendinblueBlock extends BlockBase implements ContainerFactoryPluginInterface {
private $formBuilder;
public function __construct(array $configuration, $plugin_id, array $plugin_definition, FormBuilderInterface $formBuilder) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->formBuilder = $formBuilder;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('form_builder'));
}
public function build() {
$getPluginDefinition = $this
->getPluginDefinition();
return $this->formBuilder
->getForm(SubscribeForm::class, $getPluginDefinition['mcsId']);
}
}