Commit dd4aecdd authored by renatog's avatar renatog
Browse files

Revert "Issue #3276084 by karanpagare, RenatoG, Ruturaj Chaubey: Fix all...

Revert "Issue #3276084 by karanpagare, RenatoG, Ruturaj Chaubey: Fix all dependency injection in the Invite"

This reverts commit b53c1b21.
parent b53c1b21
Loading
Loading
Loading
Loading
+1 −27
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ 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.
@@ -20,35 +19,10 @@ 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 = $this->formBuilder->getForm(new InviteLinkBlockForm(), $block_id);
    $form = \Drupal::formBuilder()->getForm(new InviteLinkBlockForm(), $block_id);
    $build['form'] = $form;

    return $build;
+2 −10
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ 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.
@@ -49,12 +48,6 @@ class InviteTypeForm extends EntityForm {
   */
  protected $messenger;

  /**
   * {@inheritdoc}
   */

  protected $configFactory;

  /**
   * {@inheritdoc}
   */
@@ -70,12 +63,11 @@ class InviteTypeForm extends EntityForm {
  /**
   * {@inheritdoc}
   */
  public function __construct(InvitePluginManager $plugin_manager, BlockManager $block_plugin_manager, Connection $database, MessengerInterface $messenger, ConfigFactory $configFactory) {
  public function __construct(InvitePluginManager $plugin_manager, BlockManager $block_plugin_manager, Connection $database, MessengerInterface $messenger) {
    $this->pluginManager = $plugin_manager;
    $this->database = $database;
    $this->blockManager = $block_plugin_manager;
    $this->messenger = $messenger;
    $this->configFactory = $configFactory;
  }

  /**
@@ -83,7 +75,7 @@ class InviteTypeForm extends EntityForm {
   */
  public function getDefaultSendMethods($invite_type) {
    $defaults = [];
    foreach (explode('||', $this->configFactory->get('invite.invite_sender.' . $invite_type->getType())->get('sending_methods')) as $sending_method) {
    foreach (explode('||', \Drupal::config('invite.invite_sender.' . $invite_type->getType())->get('sending_methods')) as $sending_method) {
      if ($sending_method != '0') {
        $defaults[$sending_method] = $sending_method;
      }