Lyon, France
Account created on 24 March 2017, over 7 years ago
#

Merge Requests

Recent comments

🇫🇷France Nicolas S. Lyon, France

Patch 2700667-133.test-only.patch works for me with a drupal 10.2.7 & php 8.2.x

🇫🇷France Nicolas S. Lyon, France

Patch on comment #79 apply in a Drupal 10.2.7
Attribute required appear on html input radio but when you submit a form with a required radio TRUE, we don't have native error message but in console I see a mysterious javascrit error

An invalid form control with name='field_contact_email' is not focusable. <input data-drupal-selector=​"edit-field-contact-email-1" required=​"required" type=​"radio" id=​"edit-field-contact-email-1" name=​"field_contact_email" value=​"1" class=​"form-radio">​

🇫🇷France Nicolas S. Lyon, France

We have an antoher with hook_theme

bundle.html.twig not working because bundle is not defined in subentity hook_theme

When I try in my custom module, I don't have all suggestion

/**
 * Implements hook_theme().
 */
function MY_MODULE_theme() {
  return [
    'bundle' => [
      'render element' => 'elements',
      'base hook' => 'subentity',
    ],
  ];
}
🇫🇷France Nicolas S. Lyon, France

Hi @anfor,

I'm according to you but my project, it is in Drupal 10.2.x et we are a conflict with drush < 12.4.1 (https://packagist.org/packages/drupal/core)

So, I can't create a subentity with 2.x and Drupal 10.2.x/Drush 12.x

🇫🇷France Nicolas S. Lyon, France

Hi @plopesc,

It's ok for last version of path_redirect_import. My problem was that the modules which were dependent were not activated.

🇫🇷France Nicolas S. Lyon, France

I test this code but it seems not ok

diff --git a/www/modules/contrib/subentity/composer.json b/www/modules/contrib/subentity/composer.json
index 732579a83..6f6bf80ac 100644
--- a/www/modules/contrib/subentity/composer.json
+++ b/www/modules/contrib/subentity/composer.json
@@ -8,6 +8,6 @@
         "drupal/core": "^9 || ^10"
     },
     "conflict": {
-        "drush/drush": "<11"
+        "drush/drush": "<12"
     }
 }
diff --git a/www/modules/contrib/subentity/src/Generators/Entity/SubEntityGenerator.php b/www/modules/contrib/subentity/src/Generators/Entity/SubEntityGenerator.php
index 635306a2a..a537300ee 100644
--- a/www/modules/contrib/subentity/src/Generators/Entity/SubEntityGenerator.php
+++ b/www/modules/contrib/subentity/src/Generators/Entity/SubEntityGenerator.php
@@ -2,77 +2,71 @@
 
 namespace Drupal\subentity\Generators\Entity;
 
-use DrupalCodeGenerator\Command\ModuleGenerator;
+use DrupalCodeGenerator\Asset\AssetCollection;
+use DrupalCodeGenerator\Attribute\Generator;
+use DrupalCodeGenerator\Command\BaseGenerator;
 use DrupalCodeGenerator\Utils;
 
+#[Generator(
+  name: 'entity:subentity',
+  description: 'Generates a subentity.',
+  aliases: ['subentity'],
+  templatePath:  __DIR__ . '/../../../templates/',
+)]
 /**
  * Implements subentity command.
  */
-final class SubEntityGenerator extends ModuleGenerator {
+final class SubEntityGenerator extends BaseGenerator {
 
   /**
    * {@inheritdoc}
    */
-  protected string $name = 'entity:subentity';
+  protected function generate(array &$vars, AssetCollection $assets): void {
+    $ir = $this->createInterviewer($vars);
 
-  /**
-   * {@inheritdoc}
-   */
-  protected string $alias = 'subentity';
-
-  /**
-   * {@inheritdoc}
-   */
-  protected string $description = 'Generates a subentity.';
-
-  /**
-   * {@inheritdoc}
-   */
-  protected string $templatePath = __DIR__ . '/../../../templates/';
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function generate(array &$vars): void {
-    $this->collectDefault($vars);
-
-    $vars['label'] = $this->ask('Entity label', '{name}');
-    $vars['entity_class'] = $this->ask('Class name', '{label|camelize}');
-    $vars['bundle'] = $this->confirm('Has bundle?', FALSE);
+    $vars['label'] = $ir->ask('Entity label', '{name}');
+    $vars['entity_class'] = $ir->ask('Class name', '{label|camelize}');
+    $vars['bundle'] = $ir->confirm('Has bundle?', FALSE);
     $vars['entity_name'] = Utils::human2machine($vars['entity_class']);
 
-    $this->addFile(
-      'src/Entity/{entity_class}.php',
-      'generator/subentity.php.twig'
-    );
-
-    $this->addFile(
-      '{machine_name}.links.menu.yml',
-      'generator/links.menu.yml.twig'
-    )->prependIfExists();
-
-    $this->addFile(
-      '{machine_name}.links.task.yml',
-      'generator/links.task.yml.twig'
-    )->prependIfExists();
+    if ($vars['entity_class']) {
+      $assets->addFile(
+        'src/Entity/{entity_class}.php',
+        'generator/subentity.php.twig'
+      );
+    }
 
-    $this->addFile(
-      '{machine_name}.routing.yml',
-      'generator/routing.yml.twig'
-    )->prependIfExists();
+    if ($vars['machine_name']) {
+      $assets->addFile(
+        '{machine_name}.links.menu.yml',
+        'generator/links.menu.yml.twig'
+      )->prependIfExists();
+
+      $assets->addFile(
+        '{machine_name}.links.task.yml',
+        'generator/links.task.yml.twig'
+      )->prependIfExists();
+
+      $assets->addFile(
+        '{machine_name}.routing.yml',
+        'generator/routing.yml.twig'
+      )->prependIfExists();
+    }
 
-    if ($vars['bundle']) {
-      $this->addFile(
+    if ($vars['entity_class']) {
+      $assets->addFile(
         'src/Entity/{entity_class}Type.php',
         'generator/subentity_type.php.twig'
       );
 
-      $this->addFile(
+      $assets->addFile(
         'config/schema/{entity_name}_type.yml',
         'generator/subentity_type.schema.yml'
       );
+    }
 
-      $this->addFile(
+    if ($vars['machine_name']) {
+      $assets->addFile(
         '{machine_name}.links.action.yml',
         'generator/links.action.yml.twig'
       );
🇫🇷France Nicolas S. Lyon, France

Hi plopesc,

I'm according to you, because when I can access the class on click control under my IDE. There is no custom code so I am confused. I will continue via xdebug because it blocks my version upgrade to D10

🇫🇷France Nicolas S. Lyon, France

I use Migrate tools 6.0.2 & Path Redirect Import 2.0.8
I delete module/custom/path_redirect_import and do a composer install to be sure to have the lastest version and my drush deploy failed
However I can clearly see the change in PathRedirectImportCommands.php

🇫🇷France Nicolas S. Lyon, France

Sorry but, with last version 2.0.x-dev, I have already the same error on drush cim/updb even after a drush cr

Why simply extends DrushCommands instead of MigrateToolsCommands ?

The command "/var/www/html/activateurdeprogres/vendor/bin/drush updatedb --no-cache-clear --uri=http://activateurdeprogres.localhost --root=/var/www/html/activateurdeprogres/www" failed.

Exit Code: 1(General error)

Working directory:

Output:
================
Error: Class "Drupal\migrate_tools\Drush\MigrateToolsCommands" not found in include() (line 30 of /var/www/html/activateurdeprogres/www/modules/contrib/path_redirect_import/src/Drush/Commands/PathRed
irectImportCommands.php).

Error Output:
================
[error] Error: Class "Drupal\migrate_tools\Drush\MigrateToolsCommands" not found in include() (line 30 of /var/www/html/activateurdeprogres/www/modules/contrib/path_redirect_import/src/Drush/Comman
ds/PathRedirectImportCommands.php) #0 /var/www/html/activateurdeprogres/vendor/composer/ClassLoader.php(571): include()
#1 /var/www/html/activateurdeprogres/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#3 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/DrupalBoot8.php(341): method_exists()
#4 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/DrupalBoot8.php(324): Drush\Boot\DrupalBoot8->hasStaticCreateFactory()
#5 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/DrupalBoot8.php(253): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands()
#6 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/BootstrapManager.php(291): Drush\Boot\DrupalBoot8->bootstrapDrupalFull()
#7 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/BootstrapManager.php(432): Drush\Boot\BootstrapManager->doBootstrap()
#8 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/BootstrapManager.php(384): Drush\Boot\BootstrapManager->bootstrapToPhaseIndex()
#9 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/BootstrapHook.php(32): Drush\Boot\BootstrapManager->bootstrapToPhase()
#10 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(44): Drush\Boot\BootstrapHook->initialize()
#11 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(36): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDis
patcher->doInitializeHook()
#12 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(29): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDis
patcher->callInitializeHook()
#13 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/CommandProcessor.php(145): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize()
#14 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(376): Consolidation\AnnotatedCommand\CommandProcessor->initializeHook()
#15 /var/www/html/activateurdeprogres/vendor/symfony/console/Command/Command.php(221): Consolidation\AnnotatedCommand\AnnotatedCommand->initialize()
#16 /var/www/html/activateurdeprogres/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run()
#17 /var/www/html/activateurdeprogres/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand()
#18 /var/www/html/activateurdeprogres/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#19 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
#20 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
#21 /var/www/html/activateurdeprogres/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run()
#22 /var/www/html/activateurdeprogres/vendor/drush/drush/drush(4): require('...')
#23 /var/www/html/activateurdeprogres/vendor/bin/drush(117): include('...')
#24 {main}.
Error: Class "Drupal\migrate_tools\Drush\MigrateToolsCommands" not found in /var/www/html/activateurdeprogres/www/modules/contrib/path_redirect_import/src/Drush/Commands/PathRedirectImportCommands.ph
p on line 30 #0 /var/www/html/activateurdeprogres/vendor/composer/ClassLoader.php(571): include()
#1 /var/www/html/activateurdeprogres/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#3 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/DrupalBoot8.php(341): method_exists()
#4 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/DrupalBoot8.php(324): Drush\Boot\DrupalBoot8->hasStaticCreateFactory()
#5 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/DrupalBoot8.php(253): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands()
#6 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/BootstrapManager.php(291): Drush\Boot\DrupalBoot8->bootstrapDrupalFull()
#7 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/BootstrapManager.php(432): Drush\Boot\BootstrapManager->doBootstrap()
#8 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/BootstrapManager.php(384): Drush\Boot\BootstrapManager->bootstrapToPhaseIndex()
#9 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Boot/BootstrapHook.php(32): Drush\Boot\BootstrapManager->bootstrapToPhase()
#10 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(44): Drush\Boot\BootstrapHook->initialize()
#11 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(36): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDis
patcher->doInitializeHook()
#12 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(29): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDis
patcher->callInitializeHook()
#13 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/CommandProcessor.php(145): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize()
#14 /var/www/html/activateurdeprogres/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(376): Consolidation\AnnotatedCommand\CommandProcessor->initializeHook()
#15 /var/www/html/activateurdeprogres/vendor/symfony/console/Command/Command.php(221): Consolidation\AnnotatedCommand\AnnotatedCommand->initialize()
#16 /var/www/html/activateurdeprogres/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run()
#17 /var/www/html/activateurdeprogres/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand()
#18 /var/www/html/activateurdeprogres/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#19 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
#20 /var/www/html/activateurdeprogres/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
#21 /var/www/html/activateurdeprogres/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run()
#22 /var/www/html/activateurdeprogres/vendor/drush/drush/drush(4): require('...')
#23 /var/www/html/activateurdeprogres/vendor/bin/drush(117): include('...')
#24 {main}
[warning] Drush command terminated abnormally.

🇫🇷France Nicolas S. Lyon, France

Thanks you @plopesc, problem that I had was well described by @Pitabas, it was during a D9.5 to D.10 migration

🇫🇷France Nicolas S. Lyon, France

With this diff a fix more error but now on this form settings /admin/config/social-api/social-auth/twitter

I have this error but I don't see where it is

Uncaught PHP Exception Symfony\\Component\\Routing\\Exception\\RouteNotFoundException: "Route "" does not exist." at /var/www/html/project/www/core/lib/Drupal/Core/Routing/RouteProvider.php line 206

diff --git a/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php b/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php
index fb976a351..7b8f0a229 100644
--- a/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php
+++ b/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php
@@ -33,6 +33,10 @@ protected function getEditableConfigNames(): array {
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, ?NetworkInterface $network = NULL): array {
+ /** @var \Drupal\social_auth\Plugin\Network\NetworkInterface $network */
+ $network = $this->networkManager->createInstance('social_auth_twitter');
+ $form = parent::buildForm($form, $form_state, $network);
+
$config = $this->config('social_auth_twitter.settings');

$form['twitter_settings'] = [
@@ -65,7 +69,7 @@ public function buildForm(array $form, FormStateInterface $form_state, ?NetworkI
'#default_value' => Url::fromRoute('social_auth_twitter.callback')->setAbsolute()->toString(),
];

- return parent::buildForm($form, $form_state);
+ return $form;
}

/**
diff --git a/social_auth_twitter/src/Plugin/Network/TwitterAuth.php b/social_auth_twitter/src/Plugin/Network/TwitterAuth.php
index d442d9154..ccd99787b 100644
--- a/social_auth_twitter/src/Plugin/Network/TwitterAuth.php
+++ b/social_auth_twitter/src/Plugin/Network/TwitterAuth.php
@@ -6,6 +6,7 @@
use Drupal\social_api\SocialApiException;
use Drupal\social_auth\Plugin\Network\NetworkBase;
use Abraham\TwitterOAuth\TwitterOAuth;
+use Drupal\social_auth\Settings\SettingsInterface;
use Drupal\social_auth_twitter\Settings\TwitterAuthSettingsInterface;

/**
@@ -28,7 +29,7 @@ class TwitterAuth extends NetworkBase implements TwitterAuthInterface {
/**
* {@inheritdoc}
*/
- public function initSdk() {
+ public function initSdk(): mixed {
$class_name = '\Abraham\TwitterOAuth\TwitterOAuth';

if (!class_exists($class_name)) {
@@ -88,7 +89,7 @@ public function getSdk2($oauth_token, $oauth_token_secret) {
* True if module is configured.
* False otherwise.
*/
- protected function validateConfig(TwitterAuthSettingsInterface $settings) {
+ protected function validateConfig(SettingsInterface $settings): bool {
$consumer_key = $settings->getConsumerKey();
$consumer_secret = $settings->getConsumerSecret();
if (!$consumer_key || !$consumer_secret) {

🇫🇷France Nicolas S. Lyon, France

Here is a new patch to apply to current 4.x version

🇫🇷France Nicolas S. Lyon, France

It's ok for with a Drupal 10.1.5 and patch 16

🇫🇷France Nicolas S. Lyon, France

Patch #172 works for me with a Drupal 9.5.9

Production build 0.69.0 2024