CommerceCurrencyResolverSelectBlock.php in Commerce Currency Resolver 8
File
src/Plugin/Block/CommerceCurrencyResolverSelectBlock.php
View source
<?php
namespace Drupal\commerce_currency_resolver\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\commerce_currency_resolver\Form\CommerceCurrencyResolverSelectForm;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class CommerceCurrencyResolverSelectBlock extends BlockBase implements ContainerFactoryPluginInterface {
protected $formBuilder;
public function __construct(array $configuration, $plugin_id, $plugin_definition, FormBuilderInterface $form_builder) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->formBuilder = $form_builder;
}
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() {
$markup['form'] = $this->formBuilder
->getForm(CommerceCurrencyResolverSelectForm::class);
return $markup;
}
}