Skip to content

Commit

Permalink
phpcs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
a-frear committed Jan 30, 2024
1 parent 3398325 commit 77eae60
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
11 changes: 8 additions & 3 deletions bluecadet_accessibility.install
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php

/**
* @file
* Implements hook_install().
*/

/**
* Implements hook_install().
*/
Expand All @@ -13,7 +18,7 @@ function bluecadet_accessibility_install() {
function bluecadet_accessibility_enable_plugin() {
// Enable ajax_ally_option plugin.
$config = \Drupal::service('config.factory')->getEditable('views.settings');
$display_extenders = $config->get('display_extenders') ?: array();
$display_extenders = $config->get('display_extenders') ?: [];
$display_extenders[] = 'ajax_ally_option';
$config->set('display_extenders', $display_extenders);
$config->save();
Expand All @@ -25,10 +30,10 @@ function bluecadet_accessibility_enable_plugin() {
function bluecadet_accessibility_uninstall() {
// Disable ajax_ally_option plugin.
$config = \Drupal::service('config.factory')->getEditable('views.settings');
$display_extenders = $config->get('display_extenders') ?: array();
$display_extenders = $config->get('display_extenders') ?: [];

$key = array_search('ajax_ally_option', $display_extenders);
if ($key!== FALSE) {
if ($key !== FALSE) {
unset($display_extenders[$key]);
$config->set('display_extenders', $display_extenders);
$config->save();
Expand Down
16 changes: 5 additions & 11 deletions bluecadet_accessibility.module
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@

use Drupal\views\ViewExecutable;

/**
* Implements hook_page_attachments().
*/
// function bluecadet_accessibility_page_attachments(array &$attachments) {
// $attachments['#attached']['library'][] = 'bluecadet_accessibility/bluecadet_accessibility';
// }

/**
* Implements hook_form_views_pre_render().
*
* Add instance dates to view results.
*/
function bluecadet_accessibility_views_pre_render(ViewExecutable $view) {
function bluecadet_accessibility_views_pre_render(ViewExecutable $view)
{
// Grab the current view display.
$display = $view->getDisplay();

Expand All @@ -34,9 +28,9 @@ function bluecadet_accessibility_views_pre_render(ViewExecutable $view) {
)
) &&
empty($view->is_attachment) && empty($view->live_preview)
) {
) {

// Attach the library.
$view->element['#attached']['library'][] = 'bluecadet_accessibility/viewsAjaxA11y';
// Attach the library.
$view->element['#attached']['library'][] = 'bluecadet_accessibility/viewsAjaxA11y';
}
}
23 changes: 14 additions & 9 deletions src/EventSubscriber/ViewsAjaxResponseSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Drupal\bluecadet_accessibility\EventSubscriber;

use Drupal\bluecadet_accessibility\Ajax\ViewsAjaxReFocusCommand;
use Drupal\Core\Ajax\AnnounceCommand;
use Drupal\Core\Ajax\FocusFirstCommand;
use Drupal\views\Ajax\ViewAjaxResponse;
Expand All @@ -13,12 +12,14 @@
/**
* Alter a Views Ajax Response.
*/
class ViewsAjaxResponseSubscriber implements EventSubscriberInterface {
class ViewsAjaxResponseSubscriber implements EventSubscriberInterface
{

/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
public static function getSubscribedEvents()
{
$events[KernelEvents::RESPONSE][] = ['onResponse'];
return $events;
}
Expand All @@ -29,7 +30,8 @@ public static function getSubscribedEvents() {
* @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
* The event process.
*/
public function onResponse(FilterResponseEvent $event) {
public function onResponse(FilterResponseEvent $event)

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (9.5.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (9.5.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (9.5.x, 8.0, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (9.5.x, 8.0, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (9.5.x, 8.0, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (9.5.x, 8.0, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has invalid type Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (9.5.x, 8.1, 10.4)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead

Check failure on line 33 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (9.5.x, 8.1, 10.6)

Parameter $event of method Drupal\bluecadet_accessibility\EventSubscriber\ViewsAjaxResponseSubscriber::onResponse() has typehint with deprecated class Symfony\Component\HttpKernel\Event\FilterResponseEvent: since Symfony 4.3, use ResponseEvent instead
{
$response = $event->getResponse();

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.2, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.2.x, 8.1, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.1, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.0.x, 8.2, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.2, 10.6)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

Check failure on line 35 in src/EventSubscriber/ViewsAjaxResponseSubscriber.php

View workflow job for this annotation

GitHub Actions / test (10.1.x, 8.1, 10.4)

Call to method getResponse() on an unknown class Symfony\Component\HttpKernel\Event\FilterResponseEvent.

// Only act on a Views Ajax Response.
Expand All @@ -41,7 +43,12 @@ public function onResponse(FilterResponseEvent $event) {

$display_extenders_options = $view->display_handler->getOption('display_extenders');

if (($view->ajaxEnabled() && (isset($display_extenders_options['ajax_ally_option']['enable_ally']) && $display_extenders_options['ajax_ally_option']['enable_ally'] == TRUE)) && empty($view->is_attachment) && empty($view->live_preview)) {
if (
($view->ajaxEnabled() && (isset($display_extenders_options['ajax_ally_option']['enable_ally'])
&& $display_extenders_options['ajax_ally_option']['enable_ally'] == TRUE)
)
&& empty($view->is_attachment) && empty($view->live_preview)
) {
// Disable the default behavior of visually scrolling on view refreshes caused by form changes or pagination.
foreach ($commands as &$command) {
if (isset($command['command']) && $command['command'] === 'viewsScrollTop') {
Expand All @@ -52,20 +59,18 @@ public function onResponse(FilterResponseEvent $event) {
// Add in Announce for number of results.
$result_count = count($view->result);
// @todo variablise this in a settings page.
$msg = \Drupal::translation()->formatPlural($result_count, '1 result loaded.', '@count results loaded.');;
$msg = \Drupal::translation()->formatPlural($result_count, '1 result loaded.', '@count results loaded.');
$response->addCommand(new AnnounceCommand($msg, 'assertive'));

// Add in focus command.
if ($result_count > 0) {
// @todo variablise this in a settings page.
$response->addCommand(new FocusFirstCommand($view_selector . ' .view-content ul li'));
}
else {
} else {
// @todo variablise this in a settings page.
$response->addCommand(new FocusFirstCommand($view_selector . ' .view-empty [tabindex="0"]'));
}
}
}
}

}
2 changes: 1 addition & 1 deletion src/Plugin/views/display_extender/AjaxAllyOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\bluecadet_accessibility\Plugin\views\display_extender;

use Drupal\views\Plugin\views\display_extender\DisplayExtenderPluginBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\display_extender\DisplayExtenderPluginBase;

/**
* Ajax AJAX A11y display extender plugin.
Expand Down

0 comments on commit 77eae60

Please sign in to comment.