Commit bbf255fc authored by beagaliana's avatar beagaliana Committed by beagaliana
Browse files

Issue #3263367 by beagaliana: Fix naming for the KeyRepository object

parent 70697445
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ use Drupal\Core\Block\BlockBase;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\key\KeyRepositoryInterface;
use Drupal\key\Key;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

@@ -28,11 +27,11 @@ class WhatsappBlock extends BlockBase implements ContainerFactoryPluginInterface
    protected $configFactory;

    /**
     * The key.
     * The key repository.
     *
     * @var \Drupal\key\KeyRepositoryInterface
     */
    protected $configKey;
    protected $keyRepository;

    /**
     * Constructs a new WhatsappBlock object.
@@ -45,13 +44,13 @@ class WhatsappBlock extends BlockBase implements ContainerFactoryPluginInterface
     *   The plugin implementation definition.
     * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
     *   The factory for configuration objects.
     * @param \Drupal\key\KeyRepositoryInterface $config_key
     *   The key.
     * @param \Drupal\key\KeyRepositoryInterface $key_repository
     *   The key repository service.
     */
    public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, KeyRepositoryInterface $config_key) {
    public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, KeyRepositoryInterface $key_repository) {
        parent::__construct($configuration, $plugin_id, $plugin_definition);
        $this->configFactory = $config_factory;
        $this->configKey = $config_key;
        $this->keyRepository = $key_repository;
    }

    /**
@@ -72,7 +71,7 @@ class WhatsappBlock extends BlockBase implements ContainerFactoryPluginInterface
     */
    public function build() {
      $widget_key = $this->configFactory->get('whatsapp.settings')->get('widget_key');
      $key = $this->configKey->getKey($widget_key)->getKeyValue();
      $key = $this->keyRepository->getKey($widget_key)->getKeyValue();

      return [
        '#type' => 'inline_template',