Skip to content

Commit

Permalink
PHP 8.3 (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
AronNovak authored Nov 15, 2024
1 parent 026a547 commit d85416c
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: drupal-starter
type: drupal10
docroot: web
php_version: "8.2"
php_version: "8.3"
webserver_type: nginx-fpm
router_http_port: "8880"
router_https_port: "4443"
Expand All @@ -10,7 +10,7 @@ additional_hostnames: []
additional_fqdns: []
database:
type: mariadb
version: "10.5"
version: "10.6"
fail_on_hook_fail: true
use_dns_when_possible: true
composer_version: "2"
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "~> 1.0"
language: php
dist: jammy
php:
- 8.2
- 8.3
services:
- docker
stages:
Expand Down
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.3",
"ext-curl": "*",
"ext-dom": "*",
"ext-intl": "*",
Expand Down Expand Up @@ -131,9 +131,6 @@
"drupal/core-project-message": true,
"oomphinc/composer-installers-extender": true,
"mglaman/composer-drupal-lenient": true
},
"platform": {
"php": "8.1"
}
},
"extra": {
Expand Down
9 changes: 3 additions & 6 deletions composer.lock

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

5 changes: 4 additions & 1 deletion web/modules/custom/server_general/server_general.module
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,11 @@ function server_general_node_presave(NodeInterface $entity) {

// Get the module handler service.
$module_handler = \Drupal::service('module_handler');
if ($entity->isNew()) {
return;
}
/** @var \Drupal\node\NodeInterface $original */
$original = $entity->original;
$original = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($entity->id());
// If content moderation is used, don't allow unpublish for locked pages.
if ($module_handler->moduleExists('content_moderation') && $original->get('moderation_state')->getString() === 'published' && $entity->get('moderation_state')->getString() === 'unpublished') {
$entity->set('moderation_state', 'published');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ class MediaImage extends EntityViewBuilderPluginAbstract {
use ElementMediaTrait;
use ElementWrapTrait;

/**
* The iFrame URL helper service.
*
* @var \Drupal\media\IFrameUrlHelper
*/
protected $iFrameUrlHelper;

/**
* The responsive image style to use on Hero.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Drupal\server_general\Plugin\EntityViewBuilder;

use Drupal\Core\Block\BlockManagerInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\paragraphs\ParagraphInterface;
use Drupal\pluggable_entity_view_builder\EntityViewBuilderPluginAbstract;
use Drupal\server_general\ElementTrait\SearchTrait;
Expand Down Expand Up @@ -56,13 +57,21 @@ class ParagraphSearch extends EntityViewBuilderPluginAbstract {
*/
protected Request $request;

/**
* The renderer service.
*
* @var \Drupal\Core\Render\RendererInterface
*/
protected RendererInterface $renderer;

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$build = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$build->blockManager = $container->get('plugin.manager.block');
$build->request = $container->get('request_stack')->getCurrentRequest();
$build->renderer = $container->get('renderer');

return $build;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ final class IframeToMedia extends MediaEmbedProcessPluginBase implements Contain
*/
protected $migration;

/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

/**
* The logging service.
*
* @var \Drupal\Core\Logger\LoggerChannelInterface
*/
protected $logger;

/**
* Constructor.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,41 +64,6 @@ final class ImgToMedia extends MediaEmbedProcessPluginBase implements ContainerF
'www.livedomain.com',
];

/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

/**
* The logging service.
*
* @var \Drupal\Core\Logger\LoggerChannelInterface
*/
protected $logger;

/**
* The file system service.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;

/**
* An instance of the download process plugin.
*
* @var \Drupal\migrate\Plugin\MigrateProcessInterface
*/
protected $fileCopyPlugin;

/**
* The file mime type guesser service.
*
* @var \Symfony\Component\Mime\MimeTypeGuesserInterface
*/
protected MimeTypeGuesserInterface $mimeTypeGuesser;

/**
* Constructor.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,58 @@

namespace Drupal\server_migrate\Plugin\migrate\process;

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\file\FileInterface;
use Drupal\media\MediaInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Plugin\MigrateProcessInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
use Masterminds\HTML5;
use Symfony\Component\Mime\MimeTypeGuesserInterface;

/**
* Base class for migrate process plugins which generate media embeds.
*
* @property \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* @property \Drupal\Core\File\FileSystemInterface $fileSystem
* @property \Drupal\migrate\Plugin\MigrateProcessInterface $fileCopyPlugin
* @property \Drupal\Core\Logger\LoggerChannelInterface $logger
* @property \Symfony\Component\Mime\MimeTypeGuesserInterface $mimeTypeGuesser
*/
abstract class MediaEmbedProcessPluginBase extends ProcessPluginBase {

/**
* Entity Type Manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected EntityTypeManagerInterface $entityTypeManager;

/**
* File system service.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected FileSystemInterface $fileSystem;

/**
* Migrate transform plugin.
*
* @var \Drupal\migrate\Plugin\MigrateProcessInterface
*/
protected MigrateProcessInterface $fileCopyPlugin;

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

/**
* Mime type guesser service.
*
* @var \Symfony\Component\Mime\MimeTypeGuesserInterface
*/
protected MimeTypeGuesserInterface $mimeTypeGuesser;

/**
* These are the image extensions that the Image media type accepts.
*/
Expand Down

0 comments on commit d85416c

Please sign in to comment.