Skip to content

Commit a04ad27

Browse files
Sergey-Orlovandypost
authored andcommitted
Drupal 9 compatibility fixes
1 parent ab2294f commit a04ad27

15 files changed

+65
-20
lines changed

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
],
2424
"license": "GPL-2.0+",
2525
"require": {
26-
"drupal/core": "^8.8.4",
26+
"drupal/core": "^8.8.4 || ^9",
27+
"drupal/courier": "^2.0@alpha",
2728
"drupal/dynamic_entity_reference": "^1.0",
28-
"drupal/unlimited_number": "^1.0@beta"
29+
"drupal/unlimited_number": "^2.0"
2930
},
3031
"suggest": {
3132
"drupal/token": " Improves token UI on message template forms.",

rng.info.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ description: 'Provides the ability to create and manage events and registrations
44
package: RNG
55
core_version_requirement: ^8.8.4 || ^9.0
66
dependencies:
7-
- drupal:system (>=8.1)
87
- courier:courier
98
- dynamic_entity_reference:dynamic_entity_reference
10-
- unlimited_number:unlimited_number (>=8.x-1.0-beta2)
9+
- unlimited_number:unlimited_number

rng.services.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ services:
6060
- { name: access_check, applies_to: _event_rule_reset }
6161
access_check.rng.event_registrations_allowed:
6262
class: Drupal\rng\Access\RegistrationAddAccessCheck
63-
arguments: ['@entity.manager']
63+
arguments: ['@entity_type.manager']
6464
tags:
6565
- { name: access_check, applies_to: _registration_add_access }
6666
rng.paramconverter.entity_type_rule_component:

src/Entity/EventTypeRule.php

+13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515
* entity_keys = {
1616
* "id" = "id",
1717
* "label" = "id"
18+
* },
19+
* config_export = {
20+
* "entity_type",
21+
* "bundle",
22+
* "machine_name",
23+
* "trigger",
24+
* "conditions",
25+
* "actions",
26+
* "client",
27+
* "format",
28+
* "pager_settings",
29+
* "api_key_settings",
30+
* "parameters",
1831
* }
1932
* )
2033
*/

src/Entity/RegistrantType.php

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
* "edit-form" = "/admin/structure/rng/registrant_types/manage/{registrant_type}",
3737
* "admin-form" = "/admin/structure/rng/registrant_types/manage/{registrant_type}",
3838
* "collection" = "/admin/structure/rng/registrant_types"
39+
* },
40+
* config_export = {
41+
* "id",
42+
* "label",
43+
* "description",
44+
* "label_pattern",
3945
* }
4046
* )
4147
*/

src/Entity/RegistrationType.php

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
* "canonical" = "/admin/structure/rng/registration_types/manage/{registration_type}",
3232
* "edit-form" = "/admin/structure/rng/registration_types/manage/{registration_type}",
3333
* "delete-form" = "/admin/structure/rng/registration_types/manage/{registration_type}/delete",
34+
* },
35+
* config_export = {
36+
* "id",
37+
* "label",
38+
* "description",
3439
* }
3540
* )
3641
*/

src/Entity/RngEventType.php

+17
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@
3737
* "delete-form" = "/admin/structure/rng/event_types/manage/{rng_event_type}/delete",
3838
* "event-access-defaults" = "/admin/structure/rng/event_types/manage/{rng_event_type}/access_defaults",
3939
* "field-mapping" = "/admin/structure/rng/event_types/manage/{rng_event_type}/field_mapping",
40+
* },
41+
* config_export = {
42+
* "id",
43+
* "entity_type",
44+
* "bundle",
45+
* "mirror_operation_to_event_manage",
46+
* "custom_rules",
47+
* "default_registrant",
48+
* "allow_anon_registrants",
49+
* "auto_sync_registrants",
50+
* "auto_attach_users",
51+
* "registrant_email_field",
52+
* "event_start_date_field",
53+
* "event_end_date_field",
54+
* "people_types",
55+
* "default_messages",
56+
* "fields",
4057
* }
4158
* )
4259
*/

src/EventMeta.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function getDefaultRules($trigger = NULL) {
380380

381381
/** @var \Drupal\rng\Entity\EventTypeRuleInterface[] $default_rules */
382382
$default_rules = $this
383-
->entityManager
383+
->entityTypeManager
384384
->getStorage('rng_event_type_rule')
385385
->loadByProperties([
386386
'entity_type' => $this->getEvent()->getEntityTypeId(),

src/Form/MessageActionForm.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct(ActionManager $action_manager, EntityTypeManagerInte
5959
public static function create(ContainerInterface $container) {
6060
return new static(
6161
$container->get('plugin.manager.action'),
62-
$container->get('entity.manager'),
62+
$container->get('entity_type.manager'),
6363
$container->get('rng.event_manager')
6464
);
6565
}

src/Form/RegistrationTypeForm.php

+11-7
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,35 @@
44

55
use Drupal\Core\Entity\EntityForm;
66
use Drupal\Core\Form\FormStateInterface;
7-
use Drupal\Core\Entity\Query\QueryFactory;
87
use Drupal\Core\Link;
8+
use Drupal\Core\Entity\EntityTypeManagerInterface;
99
use Symfony\Component\DependencyInjection\ContainerInterface;
1010

1111
/**
1212
* Form controller for registration types.
1313
*/
1414
class RegistrationTypeForm extends EntityForm {
1515
/**
16-
* @var \Drupal\Core\Entity\Query\QueryFactory
16+
* An instance of the entity type manager.
17+
*
18+
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
1719
*/
18-
protected $entityQueryFactory;
20+
protected $entityTypeManager;
1921

2022
/**
2123
* {@inheritdoc}
2224
*/
23-
public function __construct(QueryFactory $query_factory) {
24-
$this->entityQueryFactory = $query_factory;
25+
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
26+
$this->entityTypeManager = $entity_type_manager;
2527
}
2628

2729
/**
2830
* {@inheritdoc}
2931
*/
3032
public static function create(ContainerInterface $container) {
31-
return new static($container->get('entity.query'));
33+
return new static(
34+
$container->get('entity_type.manager')
35+
);
3236
}
3337

3438
/**
@@ -80,7 +84,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
8084
* Callback for `id` form element in RegistrationTypeForm->buildForm.
8185
*/
8286
public function exists($entity_id, array $element, FormStateInterface $form_state) {
83-
$query = $this->entityQueryFactory->get('registration_type');
87+
$query = $this->entityTypeManager->getStorage('registration_type')->getQuery();
8488
return (bool) $query->condition('id', $entity_id)->execute();
8589
}
8690

src/Lists/EventTypeListBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageInter
4040
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
4141
return new static(
4242
$entity_type,
43-
$container->get('entity.manager')->getStorage($entity_type->id()),
44-
$container->get('entity.manager'),
43+
$container->get('entity_type.manager')->getStorage($entity_type->id()),
44+
$container->get('entity_type.manager'),
4545
$container->get('current_user')
4646
);
4747
}

src/Lists/GroupListBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageInter
4848
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
4949
return new static(
5050
$entity_type,
51-
$container->get('entity.manager')->getStorage($entity_type->id()),
51+
$container->get('entity_type.manager')->getStorage($entity_type->id()),
5252
$container->get('rng.event_manager')
5353
);
5454
}

src/Lists/RegistrationListBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageInter
5454
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
5555
return new static(
5656
$entity_type,
57-
$container->get('entity.manager')->getStorage($entity_type->id()),
57+
$container->get('entity_type.manager')->getStorage($entity_type->id()),
5858
$container->get('rng.event_manager')
5959
);
6060
}

src/Lists/RuleListBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(EntityTypeInterface $entity_type, EntityStorageInter
5858
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
5959
return new static(
6060
$entity_type,
61-
$container->get('entity.manager')->getStorage($entity_type->id()),
61+
$container->get('entity_type.manager')->getStorage($entity_type->id()),
6262
$container->get('rng.event_manager'),
6363
$container->get('redirect.destination')
6464
);

src/Plugin/Derivative/LocalActions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(EntityTypeManagerInterface $entity_manager, RoutePro
5353
*/
5454
public static function create(ContainerInterface $container, $base_plugin_id) {
5555
return new static(
56-
$container->get('entity.manager'),
56+
$container->get('entity_type.manager'),
5757
$container->get('router.route_provider'),
5858
$container->get('rng.event_manager')
5959
);

0 commit comments

Comments
 (0)