Skip to content

Commit

Permalink
Add validation interface
Browse files Browse the repository at this point in the history
  • Loading branch information
JimBacon committed Jul 17, 2024
1 parent a8200b6 commit ad1ecfc
Show file tree
Hide file tree
Showing 10 changed files with 658 additions and 98 deletions.
4 changes: 3 additions & 1 deletion .ddev/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ corepack_enable: false
# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic
# unless explicitly specified.

# mailpit_http_port: "8025"
mailpit_http_port: "8027"
# mailpit_https_port: "8026"
# The Mailpit ports can be changed from the default 8025 and 8026
# Done to avoid conflict with the Indicia mailhog port when running that
# on the same host for testing.

# host_mailpit_port: "8025"
# The mailpit port is not normally bound on the host at all, instead being routed
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.vscode/
private/
vendor/
web/
web/
composer.lock
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ Record Cleaner

A Drupal module providing a user interface to the record cleaner service.

Prerequisites
-------------

The module requires the private file system to be enabled. Depending on your
hosting arrangement, this may already be set up. You can confirm this by
inspecting the private file system path setting shown on the admin page at
`admin/config/media/file-system`

Refer to the [Drupal docs](https://www.drupal.org/docs/8/core/modules/file/overview#s-private-file-system-settings-in-drupal-8)
if you need to configure this.

Configuration
-------------

Expand Down Expand Up @@ -35,6 +46,8 @@ Run `ddev poser`.

Run `ddev symlink-project`.

The two latter commands are courtesy of https://github.com/ddev/ddev-drupal-contrib

For information on step debugging, see the
[configuration instructions](https://ddev.readthedocs.io/en/latest/users/debugging-profiling/step-debugging/).

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"cweagans/composer-patches": "~1.0",
"drupal/core-recommended": "^10",
"drupal/core-dev": "^10",
"php-parallel-lint/php-parallel-lint": "^1.2"
"php-parallel-lint/php-parallel-lint": "^1.2",
"drush/drush": "^12.5",
"drupal/admin_toolbar": "^3.4"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down Expand Up @@ -64,7 +66,6 @@
}
},
"require": {
"drupal/examples": "^4.0",
"drupal/imce": "^3.1"
}
}
16 changes: 10 additions & 6 deletions record_cleaner.services.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
services:
record_cleaner.logger_channel:
parent: logger.channel_base
arguments: ['record_cleaner']
arguments:
- 'record_cleaner'

record_cleaner.api_helper:
class: Drupal\record_cleaner\Service\ApiHelper
arguments: ['@record_cleaner.logger_channel']
arguments:
- '@record_cleaner.logger_channel'
- '@config.factory'
- '@http_client_factory'

record_cleaner.ui_helper:
class: Drupal\record_cleaner\Service\UiHelper
arguments: ['@record_cleaner.logger_channel', '@messenger']
# arguments: ['@entity_type.manager', '@messenger']
# arguments: ['@file_example.state_helper', '@file_example.file_helper', '@file_example.session_helper_wrapper', '@messenger', '@file.repository', '@file_system', '@event_dispatcher']
arguments:
- '@record_cleaner.logger_channel'
- '@messenger'

record_cleaner.csv_helper:
class: Drupal\record_cleaner\Service\CsvHelper
arguments:
- '@record_cleaner.logger_channel'
- '@entity_type.manager'
- '@stream_wrapper_manager'
- '@record_cleaner.api_helper'
27 changes: 23 additions & 4 deletions src/Controller/RecordCleanerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,32 @@


use Drupal\Core\Controller\ControllerBase;
use Drupal\record_cleaner\Service\RecordCleanerService;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\record_cleaner\Service\ApiHelper;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Controller for record cleaner pages.
*/
class RecordCleanerController {
class RecordCleanerController extends ControllerBase {

// The themeable element.
protected $element = [];


public function __construct(
protected LoggerChannelInterface $logger,
protected ApiHelper $api,
) {
}

public static function create(ContainerInterface $container) {
return new static (
$container->get('record_cleaner.logger_channel'),
$container->get('record_cleaner.api_helper'),
);
}

/**
* Returns an overview page.
* This callback is linked to the path /record_cleaner
Expand All @@ -34,8 +50,11 @@ public function overview() {
* This callback is linked to the path /record_cleaner/status
*/
public function status() {
$RecordCleanerService = \Drupal::service('record_cleaner.record_cleaner_service');
$element = $RecordCleanerService->status();
$element = [
'#type' => 'html_tag',
'#tag' => 'pre',
'#value' => $this->api->status(),
];
return $element;
}

Expand Down
Loading

0 comments on commit ad1ecfc

Please sign in to comment.