Skip to content

Commit

Permalink
Merge branch 'main' into issue/3217
Browse files Browse the repository at this point in the history
  • Loading branch information
joeparsons authored Feb 28, 2024
2 parents fd7b244 + e6e117c commit 5aeef51
Show file tree
Hide file tree
Showing 22 changed files with 80 additions and 86 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"drupal/chosen": "4.0.0",
"drupal/ckeditor": "*",
"drupal/ckeditor_bs_grid": "2.0.11",
"drupal/ckeditor_indentblock": "1.0",
"drupal/coffee": "1.3.0",
"drupal/config_distro": "2.0.0-alpha2",
"drupal/config_provider": "3.0.0-alpha1",
Expand Down
4 changes: 2 additions & 2 deletions modules/custom/az_cas/az_cas.services.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
_defaults:
autoconfigure: true
az_cas.az_cas_route_subscriber:
class: Drupal\az_cas\Routing\AzCasRouteSubscriber
arguments:
- '@config.factory'
tags:
- { name: 'event_subscriber' }
3 changes: 2 additions & 1 deletion modules/custom/az_core/az_core.services.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
services:
_defaults:
autoconfigure: true
az_core.page_cache_request_policy.deny_monitoring_page:
class: Drupal\az_core\PageCache\DenyMonitoringPage
arguments:
Expand All @@ -18,4 +20,3 @@ services:
- '@config_sync.snapshotter'
- '@config_update.config_list'
- '@module_handler'
- '@logger.channel.az_core'
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ display:
query:
type: views_query
options: { }
defaults:
css_class: false
css_class: add-pager-top-margin
display_extenders: { }
path: taxonomy/term/%
cache_metadata:
Expand Down
16 changes: 5 additions & 11 deletions modules/custom/az_core/src/AZConfigOverride.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Extension\ModuleHandler;
use Psr\Log\LoggerInterface;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;

/**
* Class AZConfigOverride.
Expand All @@ -23,9 +24,10 @@
* to avoid needing to import the changes whenever an override module is
* enabled, e.g. az_cas.
*/
class AZConfigOverride {
class AZConfigOverride implements LoggerAwareInterface {

use ConfigSnapshotStorageTrait;
use LoggerAwareTrait;

/**
* Drupal\config_provider\Plugin\ConfigCollector definition.
Expand Down Expand Up @@ -69,24 +71,16 @@ class AZConfigOverride {
*/
protected $moduleHandler;

/**
* LoggerChannel service.
*
* @var \Drupal\Core\Logger\LoggerChannel
*/
protected $logger;

/**
* Constructs a new AZConfigOverride object.
*/
public function __construct(ConfigFactoryInterface $config_factory, ModuleExtensionList $extension_list_module, ConfigCollector $config_collector, ConfigSyncSnapshotter $config_sync_snapshotter, ConfigListByProviderInterface $config_update_lister, ModuleHandler $module_handler, LoggerInterface $logger_channel) {
public function __construct(ConfigFactoryInterface $config_factory, ModuleExtensionList $extension_list_module, ConfigCollector $config_collector, ConfigSyncSnapshotter $config_sync_snapshotter, ConfigListByProviderInterface $config_update_lister, ModuleHandler $module_handler) {
$this->configFactory = $config_factory;
$this->extensionListModule = $extension_list_module;
$this->configCollector = $config_collector;
$this->configSyncSnapshotter = $config_sync_snapshotter;
$this->configUpdateLister = $config_update_lister;
$this->moduleHandler = $module_handler;
$this->logger = $logger_channel;
}

/**
Expand Down
13 changes: 3 additions & 10 deletions modules/custom/az_core/src/Routing/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
namespace Drupal\az_core\Routing;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\DependencyInjection\AutowireTrait;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Route;

/**
* Defines dynamic routes.
*/
class Routes implements ContainerInjectionInterface {

use AutowireTrait;

/**
* The config factory.
*
Expand All @@ -29,15 +31,6 @@ public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.factory')
);
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
services:
_defaults:
autoconfigure: true
az_event_trellis.trellis_helper:
class: Drupal\az_event_trellis\TrellisHelper
arguments:
Expand All @@ -13,5 +15,3 @@ services:
- '@messenger'
- '@entity_type.manager'
- '@current_user'
tags:
- { name: 'event_subscriber' }
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,16 @@ public function viewsForm(&$form, FormStateInterface $form_state) {

foreach ($this->view->result as $row_index => $row) {
$form[$this->options['id']][$row_index] = [
'#tree' => TRUE,
'#type' => 'checkbox',
// We are not able to determine a main "title" for each row, so we can
// only output a generic label.
'#title' => $this->t('Update this item'),
'#title_display' => 'invisible',
'#return_value' => $row->Id ?? '',
'#default_value' => !empty($form_state->getValue($this->options['id'])[$row_index]) ? 1 : NULL,
];

foreach ($this->view->result as $row_index => $row) {
$form[$this->options['id']][$row_index] = [
'#type' => 'checkbox',
// We are not able to determine a main "title" for each row, so we can
// only output a generic label.
'#title' => $this->t('Update this item'),
'#title_display' => 'invisible',
'#return_value' => $row->Id ?? '',
'#default_value' => !empty($form_state->getValue($this->options['id'])[$row_index]) ? 1 : NULL,
];
}
}

// Change default BulkForm label.
if (!empty($form['actions']['submit'])) {
$form['actions']['submit']['#value'] = $this->t('Import');
Expand Down
10 changes: 10 additions & 0 deletions modules/custom/az_event/az_event_trellis/src/TrellisHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public function searchEvents(array $query) {
$json = json_decode($json, TRUE);
if ($json !== NULL) {
$ids = $json['data']['Event_IDs'] ?? [];
// Ensure events are in Id order.
sort($ids);
// @todo determine cache expiration.
$expire = time() + 1800;
// Cache search result.
Expand All @@ -135,6 +137,8 @@ public function getEvents(array $trellis_ids) {
$events = [];
$fetch = [];
$url = $this->getEventEndpoint();
// Remove any duplicate ids to mimic remote API.
$trellis_ids = array_unique($trellis_ids);
// Grab events that are in cache.
foreach ($trellis_ids as $trellis_id) {
$cached = $this->getTrellisCache($trellis_id);
Expand Down Expand Up @@ -165,6 +169,12 @@ public function getEvents(array $trellis_ids) {
catch (GuzzleException $e) {
}
}
// Make sure events are in Id order regardless of cached/fetched.
// phpcs:disable Security.BadFunctions.CallbackFunctions.WarnCallbackFunctions
usort($events, function ($a, $b) {
return strcmp($a['Id'], $b['Id']);
});
// phpcs:enable Security.BadFunctions.CallbackFunctions.WarnCallbackFunctions
return $events;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ display:
row: false
filters: false
filter_groups: false
css_class: ''
css_class: add-pager-top-margin
use_ajax: true
display_description: ''
style_options: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,11 @@ display:
default_row_class: false
uses_fields: false
defaults:
css_class: false
style: false
row: false
style_options: false
css_class: add-pager-top-margin
row:
type: 'entity:node'
options:
Expand Down
4 changes: 2 additions & 2 deletions modules/custom/az_metrics/az_metrics.services.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
services:
_defaults:
autoconfigure: true
az_metrics.event_subscriber:
class: Drupal\az_metrics\EventSubscriber\AZMetricsSubscriber
arguments:
- '@database'
- '@datetime.time'
tags:
- { name: event_subscriber }
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
services:
_defaults:
autoconfigure: true
# Listens to migration events.
az_news_feeds.migrate_events_subscriber:
class: 'Drupal\az_news_feeds\EventSubscriber\AzNewsFeedsMigrateSubscriber'
arguments:
- '@config.factory'
tags:
- { name: 'event_subscriber' }
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ third_party_settings:
weight: 6
format_type: html_element
format_settings:
classes: 'col-lg-10 offset-lg-1'
classes: 'col-12'
id: ''
element: div
show_label: false
Expand Down
2 changes: 2 additions & 0 deletions modules/custom/az_news/config/install/views.view.az_news.yml
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,11 @@ display:
default_row_class: false
uses_fields: false
defaults:
css_class: false
style: false
row: false
style_options: false
css_class: add-pager-top-margin
row:
type: 'entity:node'
options:
Expand Down
1 change: 1 addition & 0 deletions modules/custom/az_paragraphs/az_paragraphs.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
- az_card
- az_core
- az_media
- ckeditor_indentblock:ckeditor_indentblock
- drupal:text
- drupal:telephone
- entity_embed:entity_embed
7 changes: 7 additions & 0 deletions modules/custom/az_paragraphs/az_paragraphs.install
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ function az_paragraphs_update_920601(&$sandbox) {
return t('Paragraph behavior settings fixed on %count paragraphs.', ['%count' => $sandbox['updated_count']]);
}

/**
* Enable ckeditor_indentblock module by default.
*/
function az_paragraphs_update_1021001() {
\Drupal::service('module_installer')->install(['ckeditor_indentblock']);
}

/**
* Enable anchor_link module for CKEditor5 by default.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ settings:
- numberedList
- '|'
- alignment
- indent
- outdent
- '|'
- bootstrapGrid
- insertTable
Expand Down Expand Up @@ -318,6 +320,8 @@ settings:
- md
- lg
- xl
ckeditor_indentblock_indent:
enable: true
linkit_extension:
linkit_enabled: true
linkit_profile: az_linkit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
services:
_defaults:
autoconfigure: true
pubmigration_subscriber:
class: Drupal\az_publication_import\EventSubscriber\AZPublicationImportEventSubscriber
arguments:
- '@messenger'
- '@entity_type.manager'
tags:
- { name: 'event_subscriber' }
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,21 @@
namespace Drupal\az_publication_import\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\system\SystemManager;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

/**
* Returns responses for Quickstart Publication Import routes.
*/
class AZPublicationImportController extends ControllerBase {

/**
* System Manager Service.
*
* @var \Drupal\system\SystemManager
* Constructs a new \Drupal\az_publication_import\Controller object.
*/
protected $systemManager;

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$instance = new static();

$instance->systemManager = $container->get('system.manager');
return $instance;
}
public function __construct(
#[Autowire(service: 'system.manager')]
protected SystemManager $systemManager,
) {}

/**
* Provides a single block from the administration menu as a page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,25 @@
use Drupal\az_publication\Entity\AZAuthorInterface;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Link;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Class AZAuthorController.
*
* Returns responses for Author routes.
*/
class AZAuthorController extends ControllerBase implements ContainerInjectionInterface {
class AZAuthorController extends ControllerBase {

/**
* The date formatter.
*
* @var \Drupal\Core\Datetime\DateFormatter
*/
protected $dateFormatter;

/**
* The renderer.
*
* @var \Drupal\Core\Render\Renderer
* Constructs a new \Drupal\az_publication\Controller object.
*/
protected $renderer;

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$instance = parent::create($container);
$instance->dateFormatter = $container->get('date.formatter');
$instance->renderer = $container->get('renderer');
return $instance;
}
public function __construct(
protected DateFormatterInterface $dateFormatter,
protected RendererInterface $renderer,
) {}

/**
* Displays a Author revision.
Expand Down
Loading

0 comments on commit 5aeef51

Please sign in to comment.