Skip to content

Commit

Permalink
EWPP-4991: Use drupal code review component from openeuropa.
Browse files Browse the repository at this point in the history
  • Loading branch information
nagyad committed Jan 21, 2025
1 parent 5ebab6c commit 04e1164
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"drupal/datetime_testing": "^1.0-beta4",
"drupal/drupal-extension": "^5.0",
"drush/drush": "^12.4",
"openeuropa/code-review": "^2.0.0-alpha6",
"openeuropa/code-review-drupal": "^1.0.0-alpha",
"openeuropa/task-runner-drupal-project-symlink": "^1.0",
"phpspec/prophecy-phpunit": "^2",
"symfony/phpunit-bridge": "^6.2"
Expand All @@ -28,6 +28,14 @@
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "git",
"url": "https://github.com/openeuropa/DrupalDriver.git"
},
{
"type": "git",
"url": "https://github.com/openeuropa/code-review-drupal.git"
}
],
"autoload": {
Expand Down Expand Up @@ -65,7 +73,9 @@
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"drupal/core-composer-scaffold": true,
"phpro/grumphp": true
"phpro/grumphp": true,
"phpro/grumphp-shim": true,
"phpstan/extension-installer": true
}
}
}
22 changes: 8 additions & 14 deletions grumphp.yml.dist
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
imports:
- { resource: vendor/openeuropa/code-review/dist/drupal-conventions.yml }
parameters:
tasks.phpcs.ignore_patterns:
- build/
- node_modules/
- vendor/
tasks.phpcs.triggered_by:
- inc
- install
- module
- php
- theme
- yml

- { resource: ./vendor/openeuropa/code-review-drupal/dist/oe-component-conventions.yml }
grumphp:
tasks:
phpparser:
ignore_patterns:
- vendor/
git_hook_variables:
EXEC_GRUMPHP_COMMAND: 'docker-compose exec -T web'

parameters:
tasks.phpstan.configuration: phpstan.neon.dist
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
includes:
- ./vendor/openeuropa/code-review-drupal/dist/phpstan.drupal.neon
19 changes: 15 additions & 4 deletions src/Controller/ExtensionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ class ExtensionsController extends ControllerBase {
*/
protected $updateHookRegistry;

/**
* The theme extension list.
*
* @var \Drupal\Core\Extension\ThemeExtensionList
*/
protected ThemeExtensionList $themeExtensionList;

/**
* ExtensionsController constructor.
*
Expand All @@ -78,14 +85,17 @@ class ExtensionsController extends ControllerBase {
* The location of the manifest file.
* @param \Drupal\Core\Update\UpdateHookRegistry $updateHookRegistry
* The update hook registry.
* @param \Drupal\Core\Extension\ThemeExtensionList $theme_extension_list
* The theme extension list.
*/
public function __construct(ModuleExtensionList $extension_list_module, ThemeHandlerInterface $theme_handler, LoggerChannelFactoryInterface $logger_factory, EventDispatcherInterface $eventDispatcher, string $manifest_file_location, UpdateHookRegistry $updateHookRegistry) {
public function __construct(ModuleExtensionList $extension_list_module, ThemeHandlerInterface $theme_handler, LoggerChannelFactoryInterface $logger_factory, EventDispatcherInterface $eventDispatcher, string $manifest_file_location, UpdateHookRegistry $updateHookRegistry, ThemeExtensionList $theme_extension_list) {
$this->moduleExtensionList = $extension_list_module;
$this->themeHandler = $theme_handler;
$this->logger = $logger_factory->get('dashboard_agent');
$this->eventDispatcher = $eventDispatcher;
$this->manifestFileLocation = $manifest_file_location;
$this->updateHookRegistry = $updateHookRegistry;
$this->themeExtensionList = $theme_extension_list;
}

/**
Expand All @@ -98,7 +108,8 @@ public static function create(ContainerInterface $container) {
$container->get('logger.factory'),
$container->get('event_dispatcher'),
$container->getParameter('oe_dashboard_agent.manifest_file_location'),
$container->get('update.update_hook_registry')
$container->get('update.update_hook_registry'),
$container->get('extension.list.theme')
);
}

Expand All @@ -122,7 +133,7 @@ public function extensions() {

// Get all available themes.
try {
$themes = $this->themeHandler->rebuildThemeData();
$themes = $this->themeExtensionList->reset()->getList();
// Sort themes by name.
uasort($themes, [ThemeExtensionList::class, 'sortByName']);
}
Expand Down Expand Up @@ -185,7 +196,7 @@ public function extensions() {
}

// Add Drupal and PHP versions.
$info['drupal_version'] = \DRUPAL::VERSION;
$info['drupal_version'] = \Drupal::VERSION;
$info['php_version'] = phpversion();

$this->addSiteVersion($info);
Expand Down

0 comments on commit 04e1164

Please sign in to comment.