Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D11 - Update most depecations in custom code #2743

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions changelogs/DP-35404.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Write your changelog entry here. Every pull request must have a changelog yml file.
#
# Change types:
# #############################################################################
# You can use one of the following types:
# - Added: For new features.
# - Changed: For changes to existing functionality.
# - Deprecated: For soon-to-be removed features.
# - Removed: For removed features.
# - Fixed: For any bug fixes.
# - Security: In case of vulnerabilities.
#
# Format
# #############################################################################
# The format is crucial. Please follow the examples below. For reference, the requirements are:
# - All 3 parts are required and you must include "Type", "description" and "issue".
# - "Type" must be left aligned and followed by a colon.
# - "description" must be indented with 2 spaces followed by a colon
# - "issue" must be indented with 4 spaces followed by a colon.
# - "issue" is for the Jira ticket number only e.g. DP-1234
# - No extra spaces, indents, or blank lines are allowed.
#
# Example:
# #############################################################################
# Fixed:
# - description: Fixes scrolling on edit pages in Safari.
# issue: DP-13314
#
# You may add more than 1 description & issue for each type using the following format:
# Changed:
# - description: Automating the release branch.
# issue: DP-10166
# - description: Second change item that needs a description.
# issue: DP-19875
# - description: Third change item that needs a description along with an issue.
# issue: DP-19843
#
Changed:
- description: D11 - Update most depecations in custom code
issue: DP-35404
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@
"friends-of-behat/mink-debug-extension": "^2",
"imbo/behat-api-extension": "^2.0",
"kint-php/kint": "^5",
"palantirnet/drupal-rector": "^0.20.3",
"phpspec/prophecy-phpunit": "^2",
"previousnext/phpunit-finder": "dev-main",
"vincentlanglet/twig-cs-fixer": "^2.5",
Expand Down
146 changes: 145 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ type: module
description: Allow deletion of individual files by priveleged editors.
package: Custom
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
dependencies:
- drupal:file
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ type: module
description: Prevent submitting node edit form while file upload in progress
package: Custom
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: Mass Active Directory
type: module
description: Integrate with Azure AD
package: Custom
core_version_requirement: ^9 || ^10
core_version_requirement: ^10 || ^11
dependencies:
- openid_connect
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ type: module
description: 'Custom pages for the mass_admin theme'
package: 'Custom'
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
dependencies:
- block
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function onKernelResponse(ResponseEvent $event) {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
public static function getSubscribedEvents(): array {
// Act after the finish ResponseSubscriber.
$events[KernelEvents::RESPONSE][] = ['onKernelResponse'];
return $events;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Mass.gov admin toolbar
type: module
description: Provides custom styles for admin toolbar. To be used with the admin_toolbar contrib module.
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
package: Custom

dependencies:
Expand Down
2 changes: 1 addition & 1 deletion docroot/modules/custom/mass_alerts/mass_alerts.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Mass.gov Alerts
type: module
description: Provides alerts related permission control and form alterations.
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
package: Custom
dependencies:
- mass_caching
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: Mass Analytics
type: module
description: Add new Analytics tab
package: Custom
core_version_requirement: ^9 || ^10
core_version_requirement: ^10 || ^11
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Mass.gov Automatic Parents
type: module
description: Temporary module to automatically assign content parents.
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
package: Custom
dependencies:
- entity_hierarchy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: mass_bigquery
type: module
description: Queries and stores analytics data from BigQuery
package: Custom
core_version_requirement: ^9 || ^10
core_version_requirement: ^10 || ^11
dependencies:
- views
2 changes: 1 addition & 1 deletion docroot/modules/custom/mass_caching/mass_caching.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Mass.gov Caching Enhancements
type: module
description: Provides caching and invalidation improvements.
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
package: Custom
dependencies:
- drupal:purge
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function onKernelResponse(ResponseEvent $event) {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
public static function getSubscribedEvents(): array {
// Act after the FinishResponseSubscriber.
$events[KernelEvents::RESPONSE][] = ['onKernelResponse', -18];
return $events;
Expand Down
2 changes: 1 addition & 1 deletion docroot/modules/custom/mass_content/mass_content.info.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Mass.gov Example Content
type: module
description: Provide something to work with.
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
package: Custom
dependencies:
- mass_types
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ services:
weight: 200
mass_content.image_style_warmer:
class: Drupal\mass_content\ImageStylesWarmer
arguments: ['@entity_type.manager', '@image.factory','@entity_type.manager']
arguments: ['@entity_type.manager', '@image.factory','@entity_type.manager', '@file.validator']
11 changes: 9 additions & 2 deletions docroot/modules/custom/mass_content/src/ImageStylesWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Image\ImageFactory;
use Drupal\file\FileInterface;
use Drupal\file\Validation\FileValidator;

/**
* Defines an images styles warmer.
Expand Down Expand Up @@ -34,6 +35,11 @@ class ImageStylesWarmer {
*/
protected $imageStyles;

/**
* @var \Drupal\file\Validation\FileValidator
*/
private FileValidator $fileValidator;

/**
* Constructs a ImageStylesWarmer object.
*
Expand All @@ -47,10 +53,11 @@ class ImageStylesWarmer {
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function __construct(EntityTypeManagerInterface $file_storage, ImageFactory $image_factory, EntityTypeManagerInterface $image_style_storage) {
public function __construct(EntityTypeManagerInterface $file_storage, ImageFactory $image_factory, EntityTypeManagerInterface $image_style_storage, FileValidator $fileValidator) {
$this->file = $file_storage->getStorage('file');
$this->image = $image_factory;
$this->imageStyles = $image_style_storage->getStorage('image_style');
$this->fileValidator = $fileValidator;
}

/**
Expand Down Expand Up @@ -92,7 +99,7 @@ private function validateImage(FileInterface $file): bool {
if ($file->isPermanent()) {
$image = $this->image->get($file->getFileUri());
$extensions = implode(' ', $image->getToolkit()->getSupportedExtensions());
if ($image->isValid() && empty(file_validate_extensions($file, $extensions))) {
if ($image->isValid() && empty($this->fileValidator->validate($file, ['FileExtension' => ['extensions' => $extensions]]))) {
return TRUE;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function render(ResultRow $values) {
$storage = $this->entityTypeManager->getStorage($entity_type_id);
$entity = $storage->load($values->nid);

$entity = $this->getEntityTranslation($entity, $values);
$entity = $this->getEntityTranslationByRelationship($entity, $values);
$build = [];
if (!isset($entity)) {
return $build;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testAccordion(string $path, string $css_selector, ?\Closure $bef
* - An optional function to call before running the test case, accepting
* a reference to the test object.
*/
public function accordionDataProvider(): array {
public static function accordionDataProvider(): array {
return [
'_QAG Binder_Report Table of Contents' => [
'report/qag-binderreport',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name: Mass Content API
type: module
description: Define's REST Resources for Mass.gov content
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^10 || ^11
package: Custom
Loading