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,99 @@
{% import '@lib/di.twig' as di %}
<?php
declare(strict_types=1);
namespace Drupal\{{ machine_name }}\Plugin\Condition;
{% apply sort_namespaces %}
use Drupal\Core\Condition\Attribute\Condition;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Condition\ConditionPluginBase;
use Drupal\Core\Form\FormStateInterface;
{% if services %}
{{ di.use(services) }}
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
{% endif %}
{% endapply %}
/**
* Provides a '{{ plugin_label }}' condition.
*/
#[Condition(
id: '{{ plugin_id }}',
label: new TranslatableMarkup('{{ plugin_label }}'),
)]
final class {{ class }} extends ConditionPluginBase {% if services %}implements ContainerFactoryPluginInterface {% endif %}{
{% if services %}
/**
* Constructs a new {{ class }} instance.
*/
public function __construct(
array $configuration,
$plugin_id,
$plugin_definition,
{{ di.signature(services) }}
) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): self {
return new self(
$configuration,
$plugin_id,
$plugin_definition,
{{ di.container(services) }}
);
}
{% endif %}
/**
* {@inheritdoc}
*/
public function defaultConfiguration(): array {
return ['example' => ''] + parent::defaultConfiguration();
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
$form['example'] = [
'#type' => 'textfield',
'#title' => $this->t('Example'),
'#default_value' => $this->configuration['example'],
];
return parent::buildConfigurationForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
$this->configuration['example'] = $form_state->getValue('example');
parent::submitConfigurationForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function summary(): string {
return (string) $this->t(
'Example: @example', ['@example' => $this->configuration['example']],
);
}
/**
* {@inheritdoc}
*/
public function evaluate(): bool {
// @todo Evaluate the condition here.
return TRUE;
}
}

View File

@ -0,0 +1,7 @@
condition.plugin.{{ plugin_id }}:
type: condition.plugin
label: '{{ plugin_label }} condition'
mapping:
age:
type: integer
label: Age