Loading modules/invite_link/src/Plugin/Block/InviteLinkBlock.php +27 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Drupal\invite_link\Plugin\Block; use Drupal\Core\Block\BlockBase; use Drupal\invite_link\Form\InviteLinkBlockForm; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides an 'InviteLinkBlock' block. Loading @@ -19,10 +20,35 @@ class InviteLinkBlock extends BlockBase { /** * {@inheritdoc} */ /** * FormBuilder. * */ protected $formBuilder; /** * Constructor. */ public function __construct($formBuilder) { $this->formBuilder = $formBuilder; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('form_builder') ); } /** * Build method. */ public function build() { $block_id = $this->getDerivativeId(); $build = []; $form = \Drupal::formBuilder()->getForm(new InviteLinkBlockForm(), $block_id); $form = $this->formBuilder->getForm(new InviteLinkBlockForm(), $block_id); $build['form'] = $form; return $build; Loading src/Form/InviteTypeForm.php +10 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use Drupal\invite\Entity\InviteSender; use Drupal\invite\InvitePluginManager; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Config\ConfigFactory; /** * Form controller for Invite type edit forms. Loading Loading @@ -48,6 +49,12 @@ class InviteTypeForm extends EntityForm { */ protected $messenger; /** * {@inheritdoc} */ protected $configFactory; /** * {@inheritdoc} */ Loading @@ -63,11 +70,12 @@ class InviteTypeForm extends EntityForm { /** * {@inheritdoc} */ public function __construct(InvitePluginManager $plugin_manager, BlockManager $block_plugin_manager, Connection $database, MessengerInterface $messenger) { public function __construct(InvitePluginManager $plugin_manager, BlockManager $block_plugin_manager, Connection $database, MessengerInterface $messenger, ConfigFactory $configFactory) { $this->pluginManager = $plugin_manager; $this->database = $database; $this->blockManager = $block_plugin_manager; $this->messenger = $messenger; $this->configFactory = $configFactory; } /** Loading @@ -75,7 +83,7 @@ class InviteTypeForm extends EntityForm { */ public function getDefaultSendMethods($invite_type) { $defaults = []; foreach (explode('||', \Drupal::config('invite.invite_sender.' . $invite_type->getType())->get('sending_methods')) as $sending_method) { foreach (explode('||', $this->configFactory->get('invite.invite_sender.' . $invite_type->getType())->get('sending_methods')) as $sending_method) { if ($sending_method != '0') { $defaults[$sending_method] = $sending_method; } Loading Loading
modules/invite_link/src/Plugin/Block/InviteLinkBlock.php +27 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Drupal\invite_link\Plugin\Block; use Drupal\Core\Block\BlockBase; use Drupal\invite_link\Form\InviteLinkBlockForm; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides an 'InviteLinkBlock' block. Loading @@ -19,10 +20,35 @@ class InviteLinkBlock extends BlockBase { /** * {@inheritdoc} */ /** * FormBuilder. * */ protected $formBuilder; /** * Constructor. */ public function __construct($formBuilder) { $this->formBuilder = $formBuilder; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('form_builder') ); } /** * Build method. */ public function build() { $block_id = $this->getDerivativeId(); $build = []; $form = \Drupal::formBuilder()->getForm(new InviteLinkBlockForm(), $block_id); $form = $this->formBuilder->getForm(new InviteLinkBlockForm(), $block_id); $build['form'] = $form; return $build; Loading
src/Form/InviteTypeForm.php +10 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use Drupal\invite\Entity\InviteSender; use Drupal\invite\InvitePluginManager; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\Config\ConfigFactory; /** * Form controller for Invite type edit forms. Loading Loading @@ -48,6 +49,12 @@ class InviteTypeForm extends EntityForm { */ protected $messenger; /** * {@inheritdoc} */ protected $configFactory; /** * {@inheritdoc} */ Loading @@ -63,11 +70,12 @@ class InviteTypeForm extends EntityForm { /** * {@inheritdoc} */ public function __construct(InvitePluginManager $plugin_manager, BlockManager $block_plugin_manager, Connection $database, MessengerInterface $messenger) { public function __construct(InvitePluginManager $plugin_manager, BlockManager $block_plugin_manager, Connection $database, MessengerInterface $messenger, ConfigFactory $configFactory) { $this->pluginManager = $plugin_manager; $this->database = $database; $this->blockManager = $block_plugin_manager; $this->messenger = $messenger; $this->configFactory = $configFactory; } /** Loading @@ -75,7 +83,7 @@ class InviteTypeForm extends EntityForm { */ public function getDefaultSendMethods($invite_type) { $defaults = []; foreach (explode('||', \Drupal::config('invite.invite_sender.' . $invite_type->getType())->get('sending_methods')) as $sending_method) { foreach (explode('||', $this->configFactory->get('invite.invite_sender.' . $invite_type->getType())->get('sending_methods')) as $sending_method) { if ($sending_method != '0') { $defaults[$sending_method] = $sending_method; } Loading