Initial Drupal 11 with DDEV setup

This commit is contained in:
gluebox
2025-10-08 11:39:17 -04:00
commit 89ef74b305
25344 changed files with 2599172 additions and 0 deletions

View File

@ -0,0 +1,12 @@
name: 'Devel Generate Example'
type: module
description: 'Create an example of a Devel Generate plugin type for testing purposes.'
package: Testing
configure: admin/config/development/generate
tags:
- developer
# Information added by Drupal.org packaging script on 2025-07-07
version: '5.4.0'
project: 'devel'
datestamp: 1751916161

View File

@ -0,0 +1,114 @@
<?php
namespace Drupal\devel_generate_example\Plugin\DevelGenerate;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\devel_generate\DevelGenerateBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a ExampleDevelGenerate plugin.
*
* @DevelGenerate(
* id = "devel_generate_example",
* label = "Example",
* description = "Generate a given number of examples.",
* url = "devel_generate_example",
* permission = "administer devel_generate",
* settings = {
* "num" = 50,
* "kill" = FALSE
* }
* )
*/
class ExampleDevelGenerate extends DevelGenerateBase implements ContainerFactoryPluginInterface {
/**
* Provides system time.
*/
protected TimeInterface $time;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static {
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$instance->time = $container->get('datetime.time');
return $instance;
}
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state): array {
$form['num'] = [
'#type' => 'textfield',
'#title' => $this->t('How many examples would you like to generate?'),
'#default_value' => $this->getSetting('num'),
'#size' => 10,
];
$form['kill'] = [
'#type' => 'checkbox',
'#title' => $this->t('Delete all examples before generating new examples.'),
'#default_value' => $this->getSetting('kill'),
];
return $form;
}
/**
* {@inheritdoc}
*/
protected function generateElements(array $values): void {
$num = $values['num'];
$kill = $values['kill'];
if ($kill) {
$this->setMessage($this->t('Old examples have been deleted.'));
}
// Creating user in order to demonstrate
// how to override default business login generation.
$edit = [
'uid' => NULL,
'name' => 'example_devel_generate',
'pass' => '',
'mail' => 'example_devel_generate@example.com',
'status' => 1,
'created' => $this->time->getRequestTime(),
'roles' => '',
// A flag to let hook_user_* know that this is a generated user.
'devel_generate' => TRUE,
];
$account = user_load_by_name('example_devel_generate');
if (!$account) {
$account = $this->entityTypeManager->getStorage('user')->create($edit);
}
// Populate all fields with sample values.
$this->populateFields($account);
$account->save();
$this->setMessage($this->t('@num_examples created.', [
'@num_examples' => $this->formatPlural($num, '1 example', '@count examples'),
]));
}
/**
* {@inheritdoc}
*/
public function validateDrushParams(array $args, array $options = []): array {
return [
'num' => $options['num'],
'kill' => $options['kill'],
];
}
}

View File

@ -0,0 +1,11 @@
name: 'Devel Generate Fields'
type: module
description: 'Alter in a base field for testing purposes.'
package: Testing
tags:
- developer
# Information added by Drupal.org packaging script on 2025-07-07
version: '5.4.0'
project: 'devel'
datestamp: 1751916161

View File

@ -0,0 +1,21 @@
<?php
/**
* @file
* Test module for field population.
*/
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* Implements hook_entity_base_field_info_alter().
*/
function devel_generate_fields_entity_base_field_info_alter(array &$fields, EntityTypeInterface $entity_type): void {
if (in_array($entity_type->id(), ['node', 'media'])) {
$fields['phish'] = BaseFieldDefinition::create('string')
->setName('phish')
->setLabel(new TranslatableMarkup('Phish music'));
}
}