Skip to content

Commit

Permalink
Issue #327: Done in PR #328
Browse files Browse the repository at this point in the history
  • Loading branch information
lexhouk authored Dec 22, 2024
2 parents 97da840 + b1d6edf commit 57bf12e
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 74 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"drupal/module_filter": "5.0.3",
"drupal/recaptcha": "3.3",
"drupal/recaptcha_preloader": "2.0.1",
"drupal/service": "2.0.1",
"drupal/service": "3.0.0",
"drupal/seven": "1.0.0",
"drupal/standwithukraine": "2.0.3",
"drupal/symfony_mailer": "1.5.0",
Expand Down
4 changes: 2 additions & 2 deletions d8.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: The installation profile for CMS Drupal 10 based on the most common

type: profile
core_version_requirement: ^10.3
version: 0.20.0.188
version: 0.21.0.189

php: 8.3

Expand All @@ -29,7 +29,7 @@ dependencies:
- jquery_ui_draggable:jquery_ui_draggable
- jquery_ui_resizable:jquery_ui_resizable
- module_filter:module_filter
- service:service
- service:service (>=2.1.0)

themes:
- seven
Expand Down
8 changes: 4 additions & 4 deletions d8.profile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use Drupal\Core\Url;
*/
function d8_form_install_configure_form_alter(
array &$form,
FormStateInterface $form_state
FormStateInterface $form_state,
): void {
$db = Database::getConnectionInfo();
$form['admin_account']['account']['name']['#default_value'] = $db['default']['username'];
Expand All @@ -31,7 +31,7 @@ function d8_form_install_configure_form_alter(
*/
function d8_form_user_login_form_alter(
array &$form,
FormStateInterface $form_state
FormStateInterface $form_state,
): void {
$form['#submit'][] = '_d8_user_login_form_submit';
}
Expand All @@ -43,7 +43,7 @@ function d8_form_user_login_form_alter(
*/
function _d8_install_configure_form_submit(
array &$form,
FormStateInterface $form_state
FormStateInterface $form_state,
): void {
global $install_state;

Expand All @@ -63,7 +63,7 @@ function _d8_install_configure_form_submit(
*/
function _d8_user_login_form_submit(
array &$form,
FormStateInterface $form_state
FormStateInterface $form_state,
): void {
if (!\Drupal::request()->request->has('destination')) {
$path = \Drupal::configFactory()->get('system.site')->get('page.front');
Expand Down
2 changes: 1 addition & 1 deletion modules/features/d8_captcha/d8_captcha.module
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function d8_captcha_captcha_alter(array &$captcha, array $info): void {
*/
function d8_captcha_library_info_alter(
array &$libraries,
string $extension
string $extension,
): void {
if (
$extension === 'recaptcha' &&
Expand Down
4 changes: 3 additions & 1 deletion modules/features/d8_link/src/D8Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class D8Url extends Url {
/**
* {@inheritdoc}
*/
public function toString($collect_bubbleable_metadata = FALSE): GeneratedUrl|string {
public function toString(
$collect_bubbleable_metadata = FALSE,
): GeneratedUrl|string {
$url = parent::toString($collect_bubbleable_metadata);

$modify = &drupal_static('d8_link');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#[FieldFormatter(
id: 'd8_link',
label: new TranslatableMarkup('D8+ Link'),
description: new TranslatableMarkup('Delete the URL scheme and default sub-domain from the link title.'),
description: new TranslatableMarkup('Remove the URL scheme and default sub-domain from the link title.'),
field_types: ['link'],
)]
class D8LinkFormatter extends LinkFormatter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace Drupal\d8_log\Plugin\EmailAdjuster;

use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\service\EmailAdjusterBase;
use Drupal\service\RendererTrait;
use Drupal\symfony_mailer\EmailInterface;
use Drupal\symfony_mailer\Processor\EmailAdjusterBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Defines the Log Email Adjuster.
Expand All @@ -18,21 +16,15 @@
* weight = 800,
* )
*/
class LogEmailAdjuster extends EmailAdjusterBase implements ContainerFactoryPluginInterface {
class LogEmailAdjuster extends EmailAdjusterBase {

use RendererTrait;

/**
* {@inheritdoc}
*/
public static function create(
ContainerInterface $container,
array $configuration,
$plugin_id,
$plugin_definition
): static {
return (new static($configuration, $plugin_id, $plugin_definition))
->addRenderer($container);
protected function creation(): static {
return $this->addRenderer();
}

/**
Expand Down
4 changes: 1 addition & 3 deletions modules/features/d8_mail/d8_mail.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ package: D8+
type: module
core_version_requirement: ^10.3 || ^11

php: 8.3

dependencies:
- service:service
- d8:d8
- symfony_mailer:symfony_mailer
8 changes: 4 additions & 4 deletions modules/features/d8_mail/d8_mail.module
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use Drupal\d8_mail\D8MailBuilder;
*/
function d8_mail_help(
string $route_name,
RouteMatchInterface $route_match
RouteMatchInterface $route_match,
): string {
$output = '';

Expand Down Expand Up @@ -44,7 +44,7 @@ function d8_mail_help(
*/
function d8_mail_library_info_alter(
array &$libraries,
string $extension
string $extension,
): void {
if ($extension === 'symfony_mailer') {
unset($libraries['test']['css']['theme']['css/test.email.css']);
Expand All @@ -66,7 +66,7 @@ function d8_mail_theme(
array $existing,
string $type,
string $theme,
string $path
string $path,
): array {
$name = 'email_wrap';
return [$name . '__html' => ['base hook' => $name]];
Expand All @@ -77,7 +77,7 @@ function d8_mail_theme(
*/
function d8_mail_theme_suggestions_email_wrap_alter(
array &$suggestions,
array $variables
array $variables,
): void {
if ($variables['is_html']) {
$suggestions[] = $variables['theme_hook_original'] . '__html';
Expand Down
5 changes: 2 additions & 3 deletions modules/features/d8_mail/src/D8MailBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Drupal\service\RequestStackTrait;
use Drupal\service\StringTranslationTrait;
use Drupal\service\TimeTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Provides functionality for styling E-mail letters.
Expand All @@ -31,8 +30,8 @@ class D8MailBuilder extends D8BuilderBase {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container): static {
return parent::create($container)
protected function creation(): static {
return parent::creation()
->addDateFormatter()
->addRequestStack()
->addStringTranslation()
Expand Down
2 changes: 1 addition & 1 deletion modules/features/d8_mail/src/EventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct(
protected ConfigFactoryInterface $configFactory,
MessengerInterface $messenger,
TranslationInterface $translation,
LoggerChannelFactoryInterface $logger_factory
LoggerChannelFactoryInterface $logger_factory,
) {
$this
->setStringTranslation($translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
protected ConfigFactoryInterface $configFactory,
protected ThemeManagerInterface $themeManager,
protected RouteMatchInterface $routeMatch,
protected LocalTaskManagerInterface $localTaskManager
protected LocalTaskManagerInterface $localTaskManager,
) {}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Controller/D8MaintenanceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace Drupal\d8\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\service\ControllerBase;
use Drupal\service\StateTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -18,8 +17,8 @@ class D8MaintenanceController extends ControllerBase {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container): static {
return parent::create($container)->addState($container);
protected function creation(): static {
return $this->addState();
}

/**
Expand Down
9 changes: 4 additions & 5 deletions src/Controller/D8WelcomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

namespace Drupal\d8\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\service\ConfigFactoryTrait;
use Drupal\service\ControllerBase;
use Drupal\service\EntityTypeManagerTrait;
use Drupal\service\RouteMatchTrait;
use Drupal\service\StateTrait;
use Drupal\service\TitleResolverTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;

/**
Expand All @@ -25,9 +24,9 @@ class D8WelcomeController extends ControllerBase {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container): static {
return parent::create($container)
->addConfigFactory($container)
protected function creation(): static {
return $this
->addConfigFactory()
->addRouteMatch()
->addState()
->addTitleResolver();
Expand Down
9 changes: 4 additions & 5 deletions src/D8BuilderBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@

namespace Drupal\d8;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\service\ClassResolverBase;
use Drupal\service\ConfigFactoryTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Provides a base for hook wrappers.
*
* @internal
* This is an internal utility class wrapping hook implementations.
*/
abstract class D8BuilderBase implements ContainerInjectionInterface {
abstract class D8BuilderBase extends ClassResolverBase {

use ConfigFactoryTrait;

/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container): static {
return (new static())->addConfigFactory($container);
protected function creation(): static {
return $this->addConfigFactory();
}

}
7 changes: 3 additions & 4 deletions src/D8Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Drupal\service\StateTrait;
use Drupal\service\StringTranslationTrait;
use Drupal\user\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Provides functionality to set up installation profile.
Expand All @@ -38,8 +37,8 @@ class D8Setup extends D8BuilderBase {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container): static {
return parent::create($container)
protected function creation(): static {
return parent::creation()
->addEntityTypeManager()
->addExtensionPathResolver()
->addModuleInstaller()
Expand Down Expand Up @@ -158,7 +157,7 @@ private function access(array &$sandbox): void {
public function module(
array|string $target,
array|string $source = NULL,
bool $uninstall = FALSE
bool $uninstall = FALSE,
): void {
if ($source !== NULL) {
foreach ((array) $source as $name) {
Expand Down
13 changes: 6 additions & 7 deletions src/Form/D8CaptchaForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\recaptcha\Form\ReCaptchaAdminSettingsForm;
use Drupal\service\ConfigFormBaseTrait;
use Drupal\service\ModuleInstallerTrait;
use Drupal\service\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Configure reCAPTCHA settings for this profile.
*/
class D8CaptchaForm extends ReCaptchaAdminSettingsForm {

use ConfigFormBaseTrait;
use ModuleInstallerTrait;
use StringTranslationTrait;

Expand All @@ -28,10 +29,8 @@ class D8CaptchaForm extends ReCaptchaAdminSettingsForm {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container): static {
return parent::create($container)
->addModuleInstaller($container)
->addStringTranslation();
protected function creation(): static {
return $this->addModuleInstaller()->addStringTranslation();
}

/**
Expand All @@ -56,7 +55,7 @@ protected function getEditableConfigNames(): array {
*/
public function buildForm(
array $form,
FormStateInterface $form_state
FormStateInterface $form_state,
): array {
$form = parent::buildForm($form, $form_state);

Expand Down Expand Up @@ -89,7 +88,7 @@ public function buildForm(
*/
public function submitForm(
array &$form,
FormStateInterface $form_state
FormStateInterface $form_state,
): void {
parent::submitForm($form, $form_state);

Expand Down
Loading

0 comments on commit 57bf12e

Please sign in to comment.