Account created on 19 July 2012, about 13 years ago
#

Merge Requests

More

Recent comments

🇧🇪Belgium herved

Answering to #24:
1. If I'm not mistaken, this looks like a crude attempt to check entity access.
AccessManager::checkNamedRoute I used here is a much cleaner alternative.
2 & 3. The access cacheability is collected with the current MR here in the formatter, but we indeed still need a test here to validate the access is respected and the cacheability as well if possible.
I'll work on that next.

🇧🇪Belgium herved

For now, I used a different solution for my project.
But I just wanted to open this to start the discussion.

🇧🇪Belgium herved

herved created an issue.

🇧🇪Belgium herved

I agree with #28, displaying inaccessible URLs is a totally valid use case.
So indeed this is not a bug, and a formatter settings does make sense.
When I created this issue, I was confused why \Drupal\Core\Url::toRenderArray had the access check, but \Drupal\Core\Url::toString didn't. But I see now that 📌 [11.x] Remove deprecated code from \Drupal\Core\Url Active removed ::toRenderArray.

I also agree with all review comments so if anyone wants to address those, please feel free. Or I will find some time later this week.
Cheers.

🇧🇪Belgium herved

It seems the main goal of ComponentSlotForm::elementValidate is to remove some values (add_more_button, _remove) from the final submitted form values which ultimately ends up in config.
I think it should not alter form elements ['#value'] but instead use $form_state->unsetValue() in elementValidate. There are some examples in core where this is pattern is used.
So I updated accordingly.

🇧🇪Belgium herved

Moving back to needs work, the LB configure form closes unexpectedly with this when adding something in a slot.
I have to dig further, possibly split off the 2nd issue.

🇧🇪Belgium herved

Could you please review this? It seems there are 2 issues:
1. states api not working
2. and I made an attempt for the ComponentForm::elementValidate and related code

🇧🇪Belgium herved

Unfortunately there is no test coverage for this ComponentForm::elementValidate
So I'm not sure what to make of it...
Looking at the gitlog, it originates from:
- https://git.drupalcode.org/project/ui_patterns/-/commit/509f99793542456e...
- https://git.drupalcode.org/project/ui_patterns/-/commit/b2216dcb5daa8653...

Moving to review to get some feedback.

🇧🇪Belgium herved

Created MR, this solves states not working, but the "enabled" key is not saved when using the TimestampFormatter, causing PHP notices.

Warning: Undefined array key "enabled" in Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter->viewElements() (line 319 of core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php).

Possibly something to do with the fact it uses #tree ?
$form['time_diff']['#tree'] = TRUE;

🇧🇪Belgium herved

herved created an issue.

🇧🇪Belgium herved

Thanks @damienmckenna

Note that, for completeness, I discovered this because it can break layout builder which generates entities for the preview (in \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getContextsDuringPreview) if the formatter assumes it has valid json (I am using a custom formatter).

🇧🇪Belgium herved

I could use some help, but this language subscriber is very suspicious...
For now one workaround is to uninstall modules with a post_update hook instead of letting config:import do it.

🇧🇪Belgium herved

Adding is_callable causes 1 test fail: ModuleHandlerTest::testImplementsHookModuleEnabled

Loading module files before updateKernel causes 1 test to fail: ClassLoaderTest::testAutoloadFromModuleFile
Here is the stacktrace:

Error: Class "Drupal\module_autoload_test\SomeClass" not found in include_once() (line 12 of core/modules/system/tests/modules/module_autoload_test/module_autoload_test.module).
Drupal\Core\Extension\Extension->load() (Line: 143)
Drupal\Core\Extension\ModuleHandler->load() (Line: 323)
Drupal\Core\Extension\ModuleInstaller->doInstall() (Line: 229)
Drupal\Core\Extension\ModuleInstaller->install() (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() (Line: 503)
Drupal\system\Form\ModulesListForm->submitForm()
call_user_func_array() (Line: 105)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 43)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 616)
Drupal\Core\Form\FormBuilder->processForm() (Line: 348)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 633)
Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
Fiber->start() (Line: 634)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 36)
Drupal\Core\Test\StackMiddleware\TestWaitTerminateMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 716)
Drupal\Core\DrupalKernel->handle() (Line: 19)
🇧🇪Belgium herved

it's also relevant that you have admin language negotiation enabled

Exactly, this is why I used demo_umami to reproduce the issue I have on my project.

I identified https://git.drupalcode.org/project/drupal/-/commit/78813e01c72ff50265df2... as the first failing commit which was introduced in 11.2.3. Issue: 💬 Drupal 11.2 upgrade causes \Drupal::$container is not initialized yet error Active
So this could be seen as regression.

🇧🇪Belgium herved

#4, indeed that also seems to work.
OTOH it seems a bit strange to me that devel_entity_type_alter gets called while devel is not installed yet. Is that a concern?
At this stage, it is still in the preparation phase calling $this->updateKernel in ModuleInstaller::doInstall.

I'm not sure what is the safest option to apply until a proper fix is found. I may go with the is_callable option for now...

🇧🇪Belgium herved

Here is the xhprof export of 2.0.9 + MR diff
With xhprof, the request takes 9.6s and SourcePluginManager::getDefinitionsForPropType and below takes 86%.

🇧🇪Belgium herved

- 2.0.9: 13.39s
- 2.0.9 + MR diff: 2.55s
- 2.0.6: 2.23s

This is definitely better, thanks.
OTOH this is on a fairly powerful machine where standard LB configure block form request takes only a ~80-100ms to load in comparison.
So the context handling of ui_patterns is still extremely expensive.
This is from Drupal\ui_patterns\SourcePluginManager::getDefinitionsForPropType and below which takes ~90% of the total request time and the call counts below it seem a bit crazy.
It does solve the immediate issue but I still believe that something should be done to further improve this. I did try to investigate but this is definitely not an easy implementation.

🇧🇪Belgium herved

Thank you @Bedir, indeed it looks like a different issue but possibly with the same root cause?
I created 🐛 Uninstalling and installing modules during config:import can lead to fatal errors Active . Would it make sense to add a check to is_callable($callable) in ModuleHandler::getFlatHookListeners ?

🇧🇪Belgium herved

Observations (so far):
- In that example, it seems to involve \Drupal\language\EventSubscriber\LanguageRequestSubscriber::onContainerInitializeSubrequestFinished, which gets called when devel gets installed. The container gets -reinitialized and triggers all the language negociation handlers and eventually hook_entity_type_alter.

This doesn't seem to be a problem when the deployment only contains a module install.
However when a module gets uninstalled (i.e.: page_cache), then ModuleInstaller::uninstall clears cached (entity) definitions at the end (see "// Flush all persistent caches.")

- Applying the patch from 🐛 ModuleHandler skips all hook implementations when invoked before the module files have been loaded Needs review solves it, but does it really make sense that devel_entity_type_alter gets called while devel is not actually installed yet?
- Another possible fix might be to ensure the hook is actually callable before adding to the list in \Drupal\Core\Extension\ModuleHandler::getFlatHookListeners

--- a/core/lib/Drupal/Core/Extension/ModuleHandler.php
+++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php
@@ -752,7 +752,7 @@ protected function getFlatHookListeners(string $hook): array {
           else {
             $callable = $listener;
           }
-          if (isset($this->moduleList[$module])) {
+          if (isset($this->moduleList[$module]) && is_callable($callable)) {
             $this->listenersByHook[$hook][] = $callable;
             $this->modulesByHook[$hook][] = $module;
           }

Would that be a better solution?

🇧🇪Belgium herved

herved created an issue.

🇧🇪Belgium herved

Yes, rolling back to 2.0.6 significantly improves performance compared to 2.0.9.
The same LB configure form goes from around 13s on 2.0.9 to 2-3s on 2.0.6.

🇧🇪Belgium herved

I believe I am facing this bug on my project.
This happens during deployment in the config:import phase, when there are both modules to be uninstalled and installed at the same time.
I did manage to reproduce on clean 11.x with demo_umami and devel

Steps (I use ddev):
- ddev drush si demo_umami -y
- ddev drush cex -y
- Now go to sites/default/files/sync/core.extension.yml:40 and replace page_cache: 0 with devel: 0
- ddev composer require --dev drupal/devel
- ddev drush deploy -y

 Error: Call to undefined function \devel_entity_type_alter() in /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php on line 479 #0 /var/www/html/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(389): Drupal\Core\  
  Extension\ModuleHandler->alter()

Stacktrace: https://gist.github.com/vever001/a80414b43d317d84e1d1aacc91cbb895

It seems to involve \Drupal\language\EventSubscriber\LanguageRequestSubscriber::onContainerInitializeSubrequestFinished.
Maybe there should be a check to \Drupal::isConfigSyncing() somewhere?
But why is it attempting to run devel_entity_type_alter while devel is not even installed yet.

🇧🇪Belgium herved

Hi @just_like_good_vibes, I'll have a look shortly and report back today, thanks.

🇧🇪Belgium herved

No problem, for now I decided to not rely on ui_styles_entity_status and opted for a custom hook_entity_view as I have other features applying background styles.

🇧🇪Belgium herved

- uasort
-- \Drupal\ui_patterns\SourcePluginBase::label
--- $this->getChoices()
Seems to trigger a lot of unnecessary trips to context handling and \Drupal\Core\Plugin\Context\ContextHandler::filterPluginDefinitionsByContexts
Eventually it doesn't use any of those and fallbacks to last line in \Drupal\ui_patterns\SourcePluginBase::label
Stacktrace: https://gist.github.com/vever001/e5f5721be404e9d4ce931d6df3dc208f

🇧🇪Belgium herved

herved created an issue.

🇧🇪Belgium herved

herved created an issue.

🇧🇪Belgium herved

herved created an issue.

🇧🇪Belgium herved

+1 on #19
As stated in #7, the current MR seems to break/ignore what the parent issue meant to achieve, which is why I suggested a simple revert for now until a proper solution is found.

🇧🇪Belgium herved

I'm currently on 5.2.0-beta3 with the fix from #9 in my main composer.json, no more issues since then.
But I tested the fix on current dev with procedure from #12 and can confirm it does solve the issue.
So +1 for me.

🇧🇪Belgium herved

Left a small non-blocking comment.
Works perfectly on my side — Many thanks for the excellent support, and thanks to the entire team behind the UI initiative!

🇧🇪Belgium herved

I managed to reproduce on a clean setup! though using xdebug to manipulate requests order.

- Install clean ui_suite_bootstrap with ddev (enable modules + theme)
- Load 1 tab with homepage and another tab with the first aggregated CSS URL on the homepage (sites/default/files/css/...)
- ddev drush cr && ddev xdebug on (clears cache, starts xdebug and clears APCu cache)
- Place a breakpoint on first line in \Composer\Autoload\ClassLoader::findFile with condition: $class === 'Drupal\ui_suite_bootstrap\HookHandler\LibraryInfoAlter'
- Now run 2 concurrent requests:
-- First load the homepage, let it hit the breakpoint and pause.
-- Then load the CSS URL page, let it hit the breakpoint as well, step over a bit and notice that it cannot find the class and will store false in apcu_add() then let it resume.
- At this point the apcu cache is corrupted. All pages are throwing "InvalidArgumentException: Class "Drupal\ui_suite_bootstrap\HookHandler\LibraryInfoAlter" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 32 of core/lib/Drupal/Core/DependencyInjection/ClassResolver.php).
"
The only way to recover is to clear APCu (e.g. via ddev restart or ddev xdebug toggle)

Maybe there are easier ways to trigger this, but this is so far one reliable way I found.
I didn't dig much further but I suggest to just register the namespace in composer as per #9.
Also, subthemes (and so starterkits) may have to do the same if they also use the same "class-based hooks".

🇧🇪Belgium herved

So far I was not able to reproduce on a clean ui_suite_bootstrap ddev setup, sadly.
But it looks like some race condition.
I could only reproduce it on my project and it happens intermittently. This seems to involve the main request + aggregated assets (CSS/JS) requests (needs aggregation enabled).

When that happens, \Composer\Autoload\ClassLoader::findFile gets called on $class Drupal\ui_suite_bootstrap\HookHandler\LibraryInfoAlter while somehow themes are not yet psr4-registered ($this->prefixDirsPsr4 doesn't contain any themes namespaces), so findFileWithExtension returns false and gets stored in apcu_add(). At this point, the only way to recover is to restart ddev or the web server which I assume clears the apcu cache.
Here is a stacktrace and method I used: https://gist.github.com/vever001/009e4163eb6d27cab26a2b5a0df41a62

I wonder precisely why they are not psr4-registered yet in such cases, because IIUC this should happen earlier in the request, in ThemeHandler::addTheme called very early on KernelEvents::REQUEST.

🇧🇪Belgium herved

Update: registering the namespace manually in composer.json does seem to work.
Still a workaround of course, but better than the proposed patch.

"autoload": {
    "psr-4": {
        "Drupal\\ui_suite_bootstrap\\": "web/themes/contrib/ui_suite_bootstrap/src",
        "Drupal\\my_subtheme\\": "web/themes/custom/my_subtheme/src"
    }
},

The one for my_subtheme is only needed if you implement hook classes similar to ui_suite_bootstrap obviously.
Make sure to composer dump-autoload after that.

🇧🇪Belgium herved

Hi, just to report that we're also facing this issue with DDEV. I think the issue is valid, but I haven’t yet investigated what’s going on exactly.

Indeed, themes don’t get PSR-4 autoloading, but these classes are invoked using ClassResolver::getInstanceFromDefinition, so should get loaded if not already?
Also, I wonder if this is specific to APCu — does disabling APCu resolve it? Just to confirm.

I don't know much about autoloading but maybe registering the namespace in composer autoload might be a better workaround for now?
I'll do some testing/investigation and update.

🇧🇪Belgium herved

This issue can be reproduced very easily with a multiple-cardinality link field, as stated in the IS.
I added steps for demo_umami.

The description added by the link module is printed in core/themes/claro/templates/form-element.html.twig:59 as description.content
🐛 Prefix is shown before description Active is a different issue and relates to the field prefix in form-element.html.twig. It doesn't solve it.

🇧🇪Belgium herved

MR rebased, attaching diff for composer

🇧🇪Belgium herved

herved made their first commit to this issue’s fork.

🇧🇪Belgium herved

I had a stab at this again but it still needs some work it seems.

🇧🇪Belgium herved

We ran into this issue after switching to layout_builder on a project.
It’s made worse by the fact that the tempstore is auto-saved whenever you visit a layout builder display (see Drupal\layout_builder\EventSubscriber\PrepareLayout::onPrepareLayout), unlike views for example. Those expire after a week. So when working on displays, you almost always end up with tempstore entries locally, leading to the issues below.

This really feels like a bug for two reasons:
1. It causes confusion, since changes are not visible on the layout builder display pages after a config:import
2. Deleting a computed / extra field / layout etc, then accessing the layout builder display causes a fatal error because the corresponding plugin cannot be found—and layout builder cannot recover.

Here is a possible solution, crude but effective:

/**
 * Implements hook_cache_flush().
 */
#[Hook('cache_flush')]
public function cacheFlush(): void {
  // Clear layout_builder defaults section storage tempstore on cache flush.
  // @see https://www.drupal.org/i/3310897
  \Drupal::database()
    ->delete('key_value_expire')
    ->condition('collection', 'tempstore.shared.layout_builder.section_storage.defaults')
    ->execute();
}
🇧🇪Belgium herved

I didn't dig much further tbh because if I'm not mistaken the report is the same as 3.0.x https://git.drupalcode.org/project/facets/-/pipelines/582244
So this is probably out of scope here and deserves its own issue?
Thanks for looking into it.

🇧🇪Belgium herved

There is another issue, several processor schemas are not defined/missing after 🐛 Config schema fix Active :
- hide_active_items_processor
- hide_1_result_facet
- list_item
- show_only_deepest_level_items_processor
- translate_entity_aggregated_fields
- uid_to_username_callback

Should we extend the scope here?

🇧🇪Belgium herved

#14 & #17, no it should not, those schema definitions should go in the module where the plugin is defined, i.e. facets_summary. These can be used without facets_exposed_filters.
Follow up created here: 🐛 Several schema definitions in wrong sub-modules Active

🇧🇪Belgium herved

herved changed the visibility of the branch 3474018-regression-class-is to hidden.

🇧🇪Belgium herved

PS: the ddev setup is outdated and the pipeline on 3.x is currently broken, out of scope here

🇧🇪Belgium herved

It looks like 🐛 Assets paths in CSS no longer rewritten when aggregation is enabled Active was committed recently.

I think all the code and tests added from both 🐛 Website error Exception: "Only file CSS assets can be optimized" Active and 🐛 Assets paths in CSS no longer rewritten when aggregation is enabled Active are not needed could be reverted if we consider this change here.
For now I will only include here the minimal changes.

🇧🇪Belgium herved

Thanks @saurabhkanva, I created a MR from patch #2 and made some minor changes.

🇧🇪Belgium herved

I rebased the MR on 11.x, I had to drop some commits and reverts that were causing conflicts so it'll be easier to rebase later.
We were previously using 🐛 Access denied to published private file if original translation is unpublished Needs review on our project but I can confirm this solution also covers it.
Also attaching static patch for composer.

🇧🇪Belgium herved

herved made their first commit to this issue’s fork.

🇧🇪Belgium herved

Hi @mably, done.
It seems there might be an intermittent issue in UserIdsTest::testUserIdsByUserValues.
https://git.drupalcode.org/issue/purge_users-3542620/-/jobs/6289407

I was able to reproduce locally by running in a loop while ddev phpunit tests/src/Kernel/UserIdsTest.php; do :; done
But this is OOS.

🇧🇪Belgium herved

@gxleano Could you confirm you are open to the idea of dropping jquery in those behaviors?
If so I can try to find some time but I noticed and opened more pressing issues/bugs.

🇧🇪Belgium herved

I created a first draft but the tests could be improved IMO (assertions, methods,...).

🇧🇪Belgium herved

herved created an issue.

🇧🇪Belgium herved

I encountered this issue as well, it looks like the tagify BEF widget expects the exposed filter to be of type "Autocomplete" and is incompatible with "Dropdown" at the moment.

🇧🇪Belgium herved

Hi @joelpittet, I know I combined 2 issues into 1 here, which may not be ideal, but they are tighly coupled.
In my understanding, considering this issue here, and the changes I propose, external files would and should never enter the ::optimizeGroup method. So does it really make sense to check for minified === TRUE && type === external in ::optimizeGroup as you proposed there? Meaning the condition is therefore not needed.

🇧🇪Belgium herved

Hello, if you are hitting "Only file JavaScript assets can be optimized" or "Only file CSS assets can be optimized" I just created 🐛 Assets paths in CSS no longer rewritten when aggregation is enabled Active which looks like a different case than the one reported here.

🇧🇪Belgium herved

Hello, thanks for creating this issue.
I did hit this as explained in #3414173-37: Add support for minified external CSS libraries (comments 37-39).
But I also hit another issue which relates to 🐛 Only file JavaScript assets with preprocessing enabled can be optimized. Active
Both are closely related so I opened 🐛 "Only file JavaScript/CSS assets can be optimized" errors in logs Active and proposed a slightly different approach.
Any feedback is welcome :) Thanks

🇧🇪Belgium herved

Tests and steps to reproduce still todo.
But any feedback is welcome.

🇧🇪Belgium herved

Opened MR
For context, I suspect we may have an infrastructure issue somewhere, possibly the reverse proxy serving stale pages.
Still, if that is the case, drupal should not fill the logs with errors. The changes here will log BadRequestHttpException warnings just like other invalid asset requests.

🇧🇪Belgium herved

Attaching static patch for composer.

🇧🇪Belgium herved

Hi, what is the purpose of this use_form details? just purely UI to put elements under this collapsible section?
If so I proposed a solution for this at [3452930-8] by using a #pre_render instead of #validate.

🇧🇪Belgium herved

I noticed a few issues and opened MR to address those https://git.drupalcode.org/project/spamspan/-/merge_requests/37

- At the moment the formatter settings with layout builder are not saved correctly and values under use_form are nested and not flattened. This happens because the form structure with layout builder is different than with field display overview form so the code in EmailSpamspanFormatter::validateSettingsForm is not correct.
- To solve this I removed this validate handler and use a #pre_render to display the use_form details while keeping the values flat.
This way it works on both and we do not need to know the entire form structure or make conditions.
- Added a test for the spamspan formatter and config schema tests for that and filter format
- Also centralized config schema under spamspan_plugin_settings so we can avoid repetition use it for the formatter and filter.

🇧🇪Belgium herved

herved made their first commit to this issue’s fork.

🇧🇪Belgium herved

Updated IS, added MR and test coverage (the test fails correctly on D11 without the fix).
Adding also static patch for composer.

Production build 0.71.5 2024