Skip to content
Snippets Groups Projects
Commit bce51611 authored by Nia Kathoni's avatar Nia Kathoni
Browse files

Issue #3480192 by andileco: Change connection class event dispatcher argument type

parent 4e316ff1
No related branches found
No related tags found
1 merge request!13Change connection class event dispatcher argument type.
Pipeline #307484 passed with warnings
......@@ -4,24 +4,26 @@
*/
(function (Drupal, once) {
Drupal.behaviors.viewsCsvSourceViewsAdmin = {
attach: function (context) {
once('views-csv-source-column-key-ajaxified', '[data-drupal-selector="edit-options-column-key-button-button"]', context).forEach(
(button) => {
const buttonParent = button.closest('.views-csv-source');
const columnKeySelector = buttonParent.querySelector('[data-views-csv-source-filter-key-selector]');
attach(context) {
once(
'views-csv-source-column-key-ajax-initialized',
'[data-drupal-selector="edit-options-column-key-button-button"]',
context,
).forEach((button) => {
const buttonParent = button.closest('.views-csv-source');
const columnKeySelector = buttonParent.querySelector(
'[data-views-csv-source-filter-key-selector]',
);
// Hiding the button.
button.style.display = 'none';
// Hiding the button.
button.style.display = 'none';
// On change trigger the views ajax to rebuild the form.
columnKeySelector.addEventListener('change', (e) => {
button.click();
});
}
);
}
// On change trigger the views ajax to rebuild the form.
columnKeySelector.addEventListener('change', (e) => {
button.click();
});
});
},
};
})(Drupal, once);
......@@ -2,7 +2,6 @@
namespace Drupal\views_csv_source\Plugin\views\field;
use Drupal\Component\Utility\Html;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Markup;
use Drupal\views\Plugin\views\field\FieldPluginBase;
......
......@@ -3,7 +3,6 @@
namespace Drupal\views_csv_source\Query;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Cache\CacheBackendInterface;
......@@ -17,6 +16,7 @@ use GuzzleHttp\Exception\GuzzleException;
use League\Csv\Reader;
use League\Csv\Statement;
use Psr\Http\Message\ResponseInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* Imitates the database connection, except for a CSV file.
......@@ -66,7 +66,7 @@ class Connection {
protected CacheBackendInterface $cache,
protected Client $httpClient,
protected TimeInterface $time,
protected ContainerAwareEventDispatcher $eventDispatcher,
protected EventDispatcherInterface $eventDispatcher,
ConfigFactoryInterface $config_factory,
LoggerChannelFactoryInterface $logger_factory,
protected array $csvContent = [],
......
......@@ -3,8 +3,8 @@
namespace Drupal\Tests\views_csv_source\Functional\Plugin;
use Drupal\file\Entity\File;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\Tests\views_csv_source\Traits\ResourcePathRetrieverTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Symfony\Component\HttpFoundation\Response;
/**
......
......@@ -2,6 +2,9 @@
namespace Drupal\Tests\views_csv_source\Traits;
/**
* Resource file path retriever methods trait.
*/
trait ResourcePathRetrieverTrait {
/**
......
......@@ -48,7 +48,7 @@ class SelectTest extends UnitTestCase {
$this->createMock('Drupal\Core\Cache\CacheBackendInterface'),
$this->createHttpClientMock(),
$this->createMock('Drupal\Component\Datetime\TimeInterface'),
$this->createMock('Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher'),
$this->createMock('Symfony\Contracts\EventDispatcher\EventDispatcherInterface'),
$this->getConfigFactoryStub(['views_csv_source.settings' => ['cache_ttl' => 3600]]),
$this->createMock('Drupal\Core\Logger\LoggerChannelFactoryInterface'),
);
......
......@@ -6,8 +6,7 @@
*/
/**
* Ensure views with CSV as their base table also have the query type set to
* views_csv_source_query.
* Ensure views with CSV as their base table has the proper query type.
*/
function views_csv_source_post_update_ensure_views_csv_have_proper_query_type(&$sandbox) {
$view_storage = \Drupal::entityTypeManager()->getStorage('view');
......@@ -18,7 +17,7 @@ function views_csv_source_post_update_ensure_views_csv_have_proper_query_type(&$
->execute();
if (!$view_ids) {
return t('This site did not have any views base table CSV that didn\'t have the proper query type views_csv_source_query.');
return t("This site did not have any views base table CSV that didn't have the proper query type views_csv_source_query.");
}
$labels = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment