Initial Drupal 11 with DDEV setup
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
.some-rule {
|
||||
display: block;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
name: 'Devel dumper test module'
|
||||
type: module
|
||||
description: 'Test pluggable dumpers.'
|
||||
package: Testing
|
||||
|
||||
# Information added by Drupal.org packaging script on 2025-07-07
|
||||
version: '5.4.0'
|
||||
project: 'devel'
|
||||
datestamp: 1751916160
|
||||
@ -0,0 +1,7 @@
|
||||
devel_dumper_test:
|
||||
version: 0
|
||||
css:
|
||||
theme:
|
||||
css/devel_dumper_test.css: {}
|
||||
js:
|
||||
js/devel_dumper_test.js: {}
|
||||
@ -0,0 +1,40 @@
|
||||
devel_dumper_test.dump:
|
||||
path: '/devel_dumper_test/dump'
|
||||
defaults:
|
||||
_controller: '\Drupal\devel_dumper_test\Controller\DumperTestController::dump'
|
||||
_title: 'Devel Dumper Test'
|
||||
requirements:
|
||||
_permission: 'access devel information'
|
||||
|
||||
devel_dumper_test.message:
|
||||
path: '/devel_dumper_test/message'
|
||||
defaults:
|
||||
_controller: '\Drupal\devel_dumper_test\Controller\DumperTestController::message'
|
||||
_title: 'Devel Dumper Test'
|
||||
requirements:
|
||||
_permission: 'access devel information'
|
||||
|
||||
devel_dumper_test.export:
|
||||
path: '/devel_dumper_test/export'
|
||||
defaults:
|
||||
_controller: '\Drupal\devel_dumper_test\Controller\DumperTestController::export'
|
||||
_title: 'Devel Dumper Test'
|
||||
requirements:
|
||||
_permission: 'access devel information'
|
||||
|
||||
devel_dumper_test.export_renderable:
|
||||
path: '/devel_dumper_test/export_renderable'
|
||||
defaults:
|
||||
_controller: '\Drupal\devel_dumper_test\Controller\DumperTestController::exportRenderable'
|
||||
_title: 'Devel Dumper Test'
|
||||
requirements:
|
||||
_permission: 'access devel information'
|
||||
|
||||
devel_dumper_test.debug:
|
||||
path: '/devel_dumper_test/debug'
|
||||
defaults:
|
||||
_controller: '\Drupal\devel_dumper_test\Controller\DumperTestController::debug'
|
||||
_title: 'Devel Dumper Test'
|
||||
requirements:
|
||||
# Specifically give access to all users for testing in testDumpersOutput().
|
||||
_access: 'TRUE'
|
||||
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_dumper_test\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\devel\DevelDumperManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Controller class for dumper_test module.
|
||||
*
|
||||
* @package Drupal\devel_dumper_test\Controller
|
||||
*/
|
||||
class DumperTestController extends ControllerBase {
|
||||
|
||||
/**
|
||||
* The dumper manager.
|
||||
*/
|
||||
protected DevelDumperManagerInterface $dumper;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container): static {
|
||||
$instance = parent::create($container);
|
||||
$instance->dumper = $container->get('devel.dumper');
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the dump output to test.
|
||||
*
|
||||
* @return array
|
||||
* The render array output.
|
||||
*/
|
||||
public function dump(): array {
|
||||
$this->dumper->dump('Test output');
|
||||
|
||||
return [
|
||||
'#markup' => 'test',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message output to test.
|
||||
*
|
||||
* @return array
|
||||
* The render array output.
|
||||
*/
|
||||
public function message(): array {
|
||||
$this->dumper->message('Test output');
|
||||
|
||||
return [
|
||||
'#markup' => 'test',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the debug output to test.
|
||||
*
|
||||
* @return array
|
||||
* The render array output.
|
||||
*/
|
||||
public function debug(): array {
|
||||
$this->dumper->debug('Test output');
|
||||
|
||||
return [
|
||||
'#markup' => 'test',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the export output to test.
|
||||
*
|
||||
* @return array
|
||||
* The render array output.
|
||||
*/
|
||||
public function export(): array {
|
||||
return [
|
||||
'#markup' => $this->dumper->export('Test output'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the renderable export output to test.
|
||||
*
|
||||
* @return array
|
||||
* The render array output.
|
||||
*/
|
||||
public function exportRenderable(): array {
|
||||
return $this->dumper->exportAsRenderable('Test output');
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_dumper_test\Plugin\Devel\Dumper;
|
||||
|
||||
use Drupal\Component\Render\MarkupInterface;
|
||||
use Drupal\devel\DevelDumperBase;
|
||||
|
||||
/**
|
||||
* Provides a AvailableTestDumper plugin.
|
||||
*
|
||||
* @DevelDumper(
|
||||
* id = "available_test_dumper",
|
||||
* label = @Translation("Available test dumper."),
|
||||
* description = @Translation("Drupal dumper for testing purposes (available).")
|
||||
* )
|
||||
*/
|
||||
class AvailableTestDumper extends DevelDumperBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dump($input, ?string $name = NULL): void {
|
||||
// Add a predetermined string to $input to check if this dumper has been
|
||||
// selected successfully.
|
||||
$input = '<pre>AvailableTestDumper::dump() ' . $input . '</pre>';
|
||||
echo $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function export(mixed $input, ?string $name = NULL): MarkupInterface|string {
|
||||
// Add a predetermined string to $input to check if this dumper has been
|
||||
// selected successfully.
|
||||
$input = '<pre>AvailableTestDumper::export() ' . $input . '</pre>';
|
||||
|
||||
return $this->setSafeMarkup($input);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exportAsRenderable($input, ?string $name = NULL): array {
|
||||
// Add a predetermined string to $input to check if this dumper has been
|
||||
// selected successfully.
|
||||
$input = '<pre>AvailableTestDumper::exportAsRenderable() ' . $input . '</pre>';
|
||||
|
||||
return [
|
||||
'#attached' => [
|
||||
'library' => ['devel_dumper_test/devel_dumper_test'],
|
||||
],
|
||||
'#markup' => $this->setSafeMarkup($input),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function checkRequirements(): bool {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_dumper_test\Plugin\Devel\Dumper;
|
||||
|
||||
use Drupal\Component\Render\MarkupInterface;
|
||||
use Drupal\devel\DevelDumperBase;
|
||||
|
||||
/**
|
||||
* Provides a NotAvailableTestDumper plugin.
|
||||
*
|
||||
* @DevelDumper(
|
||||
* id = "not_available_test_dumper",
|
||||
* label = @Translation("Not available test dumper."),
|
||||
* description = @Translation("Drupal dumper for testing purposes (not available).")
|
||||
* )
|
||||
*/
|
||||
class NotAvailableTestDumper extends DevelDumperBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dump($input, ?string $name = NULL): void {
|
||||
$input = '<pre>' . $input . '</pre>';
|
||||
echo $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function export(mixed $input, ?string $name = NULL): MarkupInterface|string {
|
||||
$input = '<pre>' . $input . '</pre>';
|
||||
|
||||
return $this->setSafeMarkup($input);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function checkRequirements(): bool {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
name: 'Devel entity test module'
|
||||
type: module
|
||||
description: 'Provides entity types for Devel tests.'
|
||||
package: Testing
|
||||
dependencies:
|
||||
- drupal:field
|
||||
- drupal:text
|
||||
- drupal:entity_test
|
||||
|
||||
# Information added by Drupal.org packaging script on 2025-07-07
|
||||
version: '5.4.0'
|
||||
project: 'devel'
|
||||
datestamp: 1751916160
|
||||
@ -0,0 +1,2 @@
|
||||
devel_entity_test.local_tasks:
|
||||
deriver: 'Drupal\devel_entity_test\Plugin\Derivative\DevelEntityTestLocalTasks'
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Test module for the entity API providing several entity types for testing.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_entity_view_mode_info_alter().
|
||||
*/
|
||||
function devel_entity_test_entity_view_mode_info_alter(array &$view_modes): void {
|
||||
$entity_info = \Drupal::entityTypeManager()->getDefinitions();
|
||||
foreach ($entity_info as $entity_type => $info) {
|
||||
if ($info->getProvider() !== 'devel_entity_test_canonical') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($view_modes[$entity_type])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$view_modes[$entity_type] = [
|
||||
'full' => [
|
||||
'label' => t('Full object'),
|
||||
'status' => TRUE,
|
||||
'cache' => TRUE,
|
||||
],
|
||||
'teaser' => [
|
||||
'label' => t('Teaser'),
|
||||
'status' => TRUE,
|
||||
'cache' => TRUE,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_entity_test\Entity;
|
||||
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
|
||||
/**
|
||||
* Defines the test entity class.
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "devel_entity_test_canonical",
|
||||
* label = @Translation("Devel test entity with canonical link"),
|
||||
* handlers = {
|
||||
* "list_builder" = "Drupal\entity_test\EntityTestListBuilder",
|
||||
* "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
|
||||
* "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
|
||||
* "form" = {
|
||||
* "default" = "Drupal\entity_test\EntityTestForm",
|
||||
* "delete" = "Drupal\entity_test\EntityTestDeleteForm"
|
||||
* },
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
|
||||
* },
|
||||
* "translation" = "Drupal\content_translation\ContentTranslationHandler",
|
||||
* "views_data" = "Drupal\entity_test\EntityTestViewsData"
|
||||
* },
|
||||
* base_table = "devel_entity_test_canonical",
|
||||
* persistent_cache = FALSE,
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "uuid" = "uuid",
|
||||
* "bundle" = "type",
|
||||
* "label" = "name",
|
||||
* "langcode" = "langcode",
|
||||
* },
|
||||
* links = {
|
||||
* "canonical" = "/devel_entity_test_canonical/{devel_entity_test_canonical}",
|
||||
* },
|
||||
* field_ui_base_route = "entity.entity_test.admin_form",
|
||||
* )
|
||||
*/
|
||||
class DevelEntityTestCanonical extends EntityTest {
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_entity_test\Entity;
|
||||
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
|
||||
/**
|
||||
* Defines the test entity class.
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "devel_entity_test_edit",
|
||||
* label = @Translation("Devel test entity with edit form link"),
|
||||
* handlers = {
|
||||
* "list_builder" = "Drupal\entity_test\EntityTestListBuilder",
|
||||
* "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
|
||||
* "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
|
||||
* "form" = {
|
||||
* "default" = "Drupal\entity_test\EntityTestForm",
|
||||
* "delete" = "Drupal\entity_test\EntityTestDeleteForm"
|
||||
* },
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
|
||||
* },
|
||||
* "translation" = "Drupal\content_translation\ContentTranslationHandler",
|
||||
* "views_data" = "Drupal\entity_test\EntityTestViewsData"
|
||||
* },
|
||||
* base_table = "devel_entity_test_edit",
|
||||
* persistent_cache = FALSE,
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "uuid" = "uuid",
|
||||
* "bundle" = "type",
|
||||
* "label" = "name",
|
||||
* "langcode" = "langcode",
|
||||
* },
|
||||
* links = {
|
||||
* "edit-form" = "/devel_entity_test_edit/manage/{devel_entity_test_edit}",
|
||||
* },
|
||||
* field_ui_base_route = "entity.entity_test.admin_form",
|
||||
* )
|
||||
*/
|
||||
class DevelEntityTestEdit extends EntityTest {
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_entity_test\Entity;
|
||||
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
|
||||
/**
|
||||
* Defines the test entity class.
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "devel_entity_test_no_links",
|
||||
* label = @Translation("Devel test entity with no links"),
|
||||
* handlers = {
|
||||
* "list_builder" = "Drupal\entity_test\EntityTestListBuilder",
|
||||
* "view_builder" = "Drupal\entity_test\EntityTestViewBuilder",
|
||||
* "access" = "Drupal\entity_test\EntityTestAccessControlHandler",
|
||||
* "form" = {
|
||||
* "default" = "Drupal\entity_test\EntityTestForm",
|
||||
* "delete" = "Drupal\entity_test\EntityTestDeleteForm"
|
||||
* },
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
|
||||
* },
|
||||
* "translation" = "Drupal\content_translation\ContentTranslationHandler",
|
||||
* "views_data" = "Drupal\entity_test\EntityTestViewsData"
|
||||
* },
|
||||
* base_table = "devel_entity_test_no_links",
|
||||
* persistent_cache = FALSE,
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "uuid" = "uuid",
|
||||
* "bundle" = "type",
|
||||
* "label" = "name",
|
||||
* "langcode" = "langcode",
|
||||
* },
|
||||
* field_ui_base_route = "entity.entity_test.admin_form",
|
||||
* )
|
||||
*/
|
||||
class DevelEntityTestNoLinks extends EntityTest {
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_entity_test\Plugin\Derivative;
|
||||
|
||||
use Drupal\Component\Plugin\Derivative\DeriverBase;
|
||||
|
||||
/**
|
||||
* Defines the local tasks for all the entity_test entities.
|
||||
*/
|
||||
class DevelEntityTestLocalTasks extends DeriverBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDerivativeDefinitions($base_plugin_definition) {
|
||||
$this->derivatives = [];
|
||||
|
||||
$this->derivatives['devel_entity_test_canonical.canonical'] = [];
|
||||
$this->derivatives['devel_entity_test_canonical.canonical']['base_route'] = "entity.devel_entity_test_canonical.canonical";
|
||||
$this->derivatives['devel_entity_test_canonical.canonical']['route_name'] = "entity.devel_entity_test_canonical.canonical";
|
||||
$this->derivatives['devel_entity_test_canonical.canonical']['title'] = 'View';
|
||||
|
||||
$this->derivatives['devel_entity_test_edit.edit'] = [];
|
||||
$this->derivatives['devel_entity_test_edit.edit']['base_route'] = "entity.devel_entity_test_edit.edit_form";
|
||||
$this->derivatives['devel_entity_test_edit.edit']['route_name'] = "entity.devel_entity_test_edit.edit_form";
|
||||
$this->derivatives['devel_entity_test_edit.edit']['title'] = 'Edit';
|
||||
|
||||
return parent::getDerivativeDefinitions($base_plugin_definition);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
name: 'Devel test module'
|
||||
type: module
|
||||
description: 'Support module for Devel testing.'
|
||||
package: Testing
|
||||
|
||||
# Information added by Drupal.org packaging script on 2025-07-07
|
||||
version: '5.4.0'
|
||||
project: 'devel'
|
||||
datestamp: 1751916160
|
||||
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Helper module for devel test.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_mail().
|
||||
*/
|
||||
function devel_test_mail($key, array &$message, array $params): void {
|
||||
if ($key === 'devel_mail_log') {
|
||||
$message['subject'] = $params['subject'];
|
||||
$message['body'][] = $params['body'];
|
||||
$message['headers']['From'] = $params['headers']['from'];
|
||||
$message['headers'] += $params['headers']['additional'];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
devel.simple_page:
|
||||
path: '/devel/simple-page'
|
||||
defaults:
|
||||
_controller: '\Drupal\devel_test\Controller\DevelTestController::simplePage'
|
||||
_title: 'Simple Page'
|
||||
requirements:
|
||||
_permission: 'access devel information'
|
||||
@ -0,0 +1,7 @@
|
||||
services:
|
||||
|
||||
devel_test.test_route_subscriber:
|
||||
class: Drupal\devel_test\Routing\TestRouteSubscriber
|
||||
arguments: ['@state']
|
||||
tags:
|
||||
- { name: event_subscriber }
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_test\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Returns responses for devel module routes.
|
||||
*/
|
||||
class DevelTestController extends ControllerBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container): static {
|
||||
$instance = parent::create($container);
|
||||
$instance->stringTranslation = $container->get('string_translation');
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a simple page output.
|
||||
*
|
||||
* @return array
|
||||
* A render array.
|
||||
*/
|
||||
public function simplePage(): array {
|
||||
return [
|
||||
'#markup' => $this->t('Simple page'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel_test\Routing;
|
||||
|
||||
use Drupal\Core\Routing\RouteSubscriberBase;
|
||||
use Drupal\Core\State\State;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* Router subscriber class for testing purpose.
|
||||
*/
|
||||
class TestRouteSubscriber extends RouteSubscriberBase {
|
||||
|
||||
/**
|
||||
* The state store.
|
||||
*/
|
||||
protected State $state;
|
||||
|
||||
/**
|
||||
* Constructor method.
|
||||
*
|
||||
* @param \Drupal\Core\State\State $state
|
||||
* The object State.
|
||||
*/
|
||||
public function __construct(State $state) {
|
||||
$this->state = $state;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function alterRoutes(RouteCollection $collection) {
|
||||
$this->state->set('devel_test_route_rebuild', 'Router rebuild fired');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user