From 10729e6994a253bf7720075374979e272e9f0d2c Mon Sep 17 00:00:00 2001 From: Hani Shaik <hani.shaik@texascreative.com> Date: Thu, 27 Mar 2025 17:45:16 +0000 Subject: [PATCH 1/9] Removed redundant help message for installing package manager --- src/Form/SettingsForm.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 17877f327..5f9337beb 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -92,13 +92,6 @@ final class SettingsForm extends ConfigFormBase { '#disabled' => $package_manager_not_ready, ]; - if ($package_manager_not_ready) { - $form['allow_ui_install_compatibility'] = [ - '#type' => 'container', - '#markup' => $this->t('The ability to install modules via the Project Browser UI requires Package Manager version 2.5 or newer. Package Manager is provided as part of the <a href="https://www.drupal.org/project/automatic_updates" target="_blank" rel="noopener noreferrer">Automatic Updates</a> module.'), - ]; - } - $source_plugins = $this->manager->getDefinitions(); $enabled_sources = $config->get('enabled_sources'); // Sort the source plugins by the order they're stored in config. -- GitLab From ff9e3e673d9c913c07bf295d3d0ecd0e56b8f1d7 Mon Sep 17 00:00:00 2001 From: Tim Plunkett <git@plnktt.com> Date: Thu, 27 Mar 2025 14:18:12 -0400 Subject: [PATCH 2/9] kick the bot --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9f621205c..d06476c17 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ## Introduction +asdf Project Browser (PB) makes it possible to find modules within your Drupal installation. It removes the need to leave the admin UI and visit Drupal.org to find and install modules. It is build to be a more intuitive experience than the module listing on Drupal.org. Only modules compatible with your site are displayed, and enhanced filtering capabilities provide a streamlined view of projects. -- GitLab From 6382697969cb41ed9aaa0ce908ad6e78e4eb0be2 Mon Sep 17 00:00:00 2001 From: Tim Plunkett <git@plnktt.com> Date: Thu, 27 Mar 2025 14:18:36 -0400 Subject: [PATCH 3/9] kick the bot pt2 --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d06476c17..9f621205c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ ## Introduction -asdf Project Browser (PB) makes it possible to find modules within your Drupal installation. It removes the need to leave the admin UI and visit Drupal.org to find and install modules. It is build to be a more intuitive experience than the module listing on Drupal.org. Only modules compatible with your site are displayed, and enhanced filtering capabilities provide a streamlined view of projects. -- GitLab From 4477351f761ae38025c884f45e91bfc4fa39bdeb Mon Sep 17 00:00:00 2001 From: Hani Shaik <hani.shaik@texascreative.com> Date: Thu, 27 Mar 2025 18:42:51 +0000 Subject: [PATCH 4/9] Revert "Removed redundant help message for installing package manager" This reverts commit d30f285515eb0e761503b442aabff27461efffc1. revert commit d30f285515eb0e761503b442aabff27461efffc1 --- src/Form/SettingsForm.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 5f9337beb..17877f327 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -92,6 +92,13 @@ final class SettingsForm extends ConfigFormBase { '#disabled' => $package_manager_not_ready, ]; + if ($package_manager_not_ready) { + $form['allow_ui_install_compatibility'] = [ + '#type' => 'container', + '#markup' => $this->t('The ability to install modules via the Project Browser UI requires Package Manager version 2.5 or newer. Package Manager is provided as part of the <a href="https://www.drupal.org/project/automatic_updates" target="_blank" rel="noopener noreferrer">Automatic Updates</a> module.'), + ]; + } + $source_plugins = $this->manager->getDefinitions(); $enabled_sources = $config->get('enabled_sources'); // Sort the source plugins by the order they're stored in config. -- GitLab From e00b9253368e9784266e4a1b0563884eefe66e41 Mon Sep 17 00:00:00 2001 From: Hani Shaik <hani.shaik@texascreative.com> Date: Thu, 27 Mar 2025 19:10:14 +0000 Subject: [PATCH 5/9] Update to help text linking to package manger and moved automatic update from require-dev to require in composer.json --- src/Form/SettingsForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 17877f327..2fdd5bbba 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -95,7 +95,7 @@ final class SettingsForm extends ConfigFormBase { if ($package_manager_not_ready) { $form['allow_ui_install_compatibility'] = [ '#type' => 'container', - '#markup' => $this->t('The ability to install modules via the Project Browser UI requires Package Manager version 2.5 or newer. Package Manager is provided as part of the <a href="https://www.drupal.org/project/automatic_updates" target="_blank" rel="noopener noreferrer">Automatic Updates</a> module.'), + '#markup' => $this->t('Enable "Package Manager" module <a href="/admin/modules#module-package-manager">here</a> to enhance your Project Browser UI Experience.'), ]; } -- GitLab From 99ad40616c6a2dffdfdd57ea8dbe049c57a7e761 Mon Sep 17 00:00:00 2001 From: Mohammed Hani Shaik <68346-mshaik@users.noreply.drupalcode.org> Date: Thu, 27 Mar 2025 19:23:58 +0000 Subject: [PATCH 6/9] Added check for administer modules permission to display help text --- src/Form/SettingsForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 2fdd5bbba..9512b4c61 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -92,7 +92,7 @@ final class SettingsForm extends ConfigFormBase { '#disabled' => $package_manager_not_ready, ]; - if ($package_manager_not_ready) { + if ($package_manager_not_ready && $this->currentUser()->hasPermission('administer modules')) { $form['allow_ui_install_compatibility'] = [ '#type' => 'container', '#markup' => $this->t('Enable "Package Manager" module <a href="/admin/modules#module-package-manager">here</a> to enhance your Project Browser UI Experience.'), -- GitLab From 0215f5752fc27e35793f23d07b4d1216a1e7a990 Mon Sep 17 00:00:00 2001 From: Hani Shaik <hani.shaik@texascreative.com> Date: Thu, 27 Mar 2025 19:25:20 +0000 Subject: [PATCH 7/9] Moved automatic updates module from require-dev to require --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ceb3887b6..4623b031a 100644 --- a/composer.json +++ b/composer.json @@ -9,11 +9,11 @@ "composer-runtime-api": "^2", "composer/semver": "^3.2", "guzzlehttp/guzzle": "^6 || ^7", + "drupal/automatic_updates": "^3.1.3", "symfony/finder": "^6.3 || ^7" }, "require-dev": { "colinodell/psr-testlogger": "^1.2", - "drupal/automatic_updates": "^3.1.3", "drush/drush": "^12.5 || ^13", "mglaman/phpstan-drupal": "<1.3.4, <2.0.2" }, -- GitLab From 51ea255bc6d81af7bea84a2f3d23dd355539d046 Mon Sep 17 00:00:00 2001 From: Lord LeEbO <jonnathan.quijano@palcera.com> Date: Mon, 31 Mar 2025 11:35:04 +0000 Subject: [PATCH 8/9] Refactor the problematic line to make the types more explicit for PHPStan --- src/Element/ProjectBrowser.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Element/ProjectBrowser.php b/src/Element/ProjectBrowser.php index 21ce9f07e..b2006f8ba 100644 --- a/src/Element/ProjectBrowser.php +++ b/src/Element/ProjectBrowser.php @@ -161,11 +161,9 @@ final class ProjectBrowser extends RenderElementBase implements ContainerFactory ); $page_sizes = array_map('intval', $element['#page_sizes']); - assert( - count($page_sizes) > 0 && - Inspector::assertAll(fn (int $value): bool => $value > 0, $page_sizes), - new \InvalidArgumentException('#page_sizes must be an array of integers greater than zero.'), - ); + assert(is_array($page_sizes) && count($page_sizes) > 0, new \InvalidArgumentException('#page_sizes must be a non-empty array.')); + Inspector::assertAll(fn (int $value): bool => $value > 0, $page_sizes); + // This sort will re-key the array. sort($page_sizes); -- GitLab From 3297aa78cc6665e395fb923ecfdb281ef674e3ce Mon Sep 17 00:00:00 2001 From: Lord LeEbO <jonnathan.quijano@palcera.com> Date: Mon, 31 Mar 2025 11:47:23 +0000 Subject: [PATCH 9/9] Revert "Refactor the problematic line to make the types more explicit for PHPStan" This reverts commit 9c48ba5366d3f89707b2e0ee35bf3011aac2faad. Reverting modified line to its original code as it did not make aany difference --- src/Element/ProjectBrowser.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Element/ProjectBrowser.php b/src/Element/ProjectBrowser.php index b2006f8ba..21ce9f07e 100644 --- a/src/Element/ProjectBrowser.php +++ b/src/Element/ProjectBrowser.php @@ -161,9 +161,11 @@ final class ProjectBrowser extends RenderElementBase implements ContainerFactory ); $page_sizes = array_map('intval', $element['#page_sizes']); - assert(is_array($page_sizes) && count($page_sizes) > 0, new \InvalidArgumentException('#page_sizes must be a non-empty array.')); - Inspector::assertAll(fn (int $value): bool => $value > 0, $page_sizes); - + assert( + count($page_sizes) > 0 && + Inspector::assertAll(fn (int $value): bool => $value > 0, $page_sizes), + new \InvalidArgumentException('#page_sizes must be an array of integers greater than zero.'), + ); // This sort will re-key the array. sort($page_sizes); -- GitLab