Europe
Account created on 1 June 2006, over 18 years ago
#

Merge Requests

More

Recent comments

miiimooo Europe

@broon thanks for trying to reproduce this. I've tested with that snippet now too and that seems to have gone away, because of the work in 🐛 Disabled tags not ignored when having child elements Fixed in dev-2x

miiimooo Europe

The latest patch works for me to fix this annoying problem. I think it might even be enough to have aliases for this problem.

BUT, I had to disable the Enforce clean and canonical URLs in the redirect settings admin/config/search/redirect/settings

miiimooo Europe

Yikes, while I can see the reason for this change, it should come with a big warning sign as it changes the order of assets like CSS and JS files, also the ones loaded in custom themes and modules. Especially CSS specificity which is based among others by order this will break most sites in subtle ways. I just tested this with a bigger site and I'm not sure I'll be able to identify all problems and upgrade to 10.4.

If I'm not alone in this, maybe there could be a backwards compatibility patch or setting that allows site maintainers non-breaking upgrades?

miiimooo Europe

I can confirm this bug, after switching to the dev version.

I used the patch mentioned in #19 like this

            "drupal/search_api_pantheon": {
                "3467907 - Use patch from #19": "https://patch-diff.githubusercontent.com/raw/pantheon-systems/search_api_pantheon/pull/197.patch"
            },

The Pantheon Solr Admin Form loads again

miiimooo Europe

@stefan.korn thanks for checking the patch. I agree that the patch is heavy. I have installed and tested now your version. With `error_reporting(E_ALL)` I get this

```
backtrace_error_handler(8192, 'parse_str(): Passing null to parameter #1 ($string) of type string is deprecated', '/app/web/modules/contrib/youtube_duration/src/Service/YoutubeDurationGetterService.php', 220)
parse_str(NULL, NULL) (Line: 220)
Drupal\youtube_duration\Service\YoutubeDurationGetterService->setVideoId() (Line: 135)
Drupal\youtube_duration\Service\YoutubeDurationGetterService->initDurationGetter(Object, Object) (Line: 94)
youtube_duration_media_presave(Object)
...
```

I used this `https://www.youtube.com/shorts/EX5_5QVl_zA`

miiimooo Europe

The same but with array_reduce:

$page_entity = array_reduce(Drupal::routeMatch()->getParameters()->all(), function($carry, $item) {
  return $carry ?? $item;
});
miiimooo Europe

Looking into the original issue #3049070: Load latest revision of node when publishing and unpublishing where the `->latestRevision() ` was added into the query, it seems this is mainly needed when content_moderation is used, and a node that is in draft state is scheduled.

Not knowing how many sites use content_moderation, I still think there is a case to only add this condition/modifier when content_moderation is actually enabled on the site. This would improve performance for all the sites using scheduler but not content moderation.

Maybe I'm missing some use case, there is a mention of content_translation but I don't see how that requires the latest revision in teh same way as content_moderation does.

Is there a chance of that a patch that limits the query could be accepted? Maybe also the OP whether that would be preferable over patching core?

miiimooo Europe

If you need to patch 2.0.0 here is the old patch that still applies correctly

miiimooo Europe

The merge request does no longer work as patch, so I'm providing a simple patch here. Patch applies with 2.2.0-alpha1

miiimooo Europe

To reproduce, create or edit a template (e.g. node.html.twig) to contain only this

{{ {
  '#type': 'processed_text',
  '#text': node.body.value,
  '#format': node.body.format,
} }}

Make sure the node's body field is empty

The website encountered an unexpected error. Try again later.

TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in htmlspecialchars() (line 440 of core/lib/Drupal/Component/Utility/Html.php).
Drupal\Component\Utility\Html::escape(Array) (Line: 793)
_filter_html_escape(Array) (Line: 26)
Drupal\filter\Plugin\Filter\FilterHtmlEscape->process(Array, '') (Line: 118)
Drupal\filter\Element\ProcessedText::preRenderText(Array)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 40)
__TwigTemplate_cc2b7de651c1a0232f84f4093e023a1f->doDisplay(Array, Array) (Line: 360)
Twig\Template->yield(Array) (Line: 335)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 37)
twig_render_template('themes/custom/hrw_design/apps/drupal/templates/content/node--interactive--full.html.twig', Array, Array) (Line: 426)
Drupal\Core\Theme\ThemeManager->render('node', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

miiimooo Europe

This worked now. It could have been an issue with the path to the recipe. I used:

terminus drush SITE.ENV -- ev "passthru('php core/scripts/drupal recipe modules/custom/MY_MODULE/recipes/follow/');"

In my repository the recipe.yml is located in

web/modules/custom/MY_MODULE/recipes/follow

Thank you.

miiimooo Europe

I have replaced the whole youtube id detection code with what's used in video_embed_field and a patch from there to support youtube shorts https://www.drupal.org/project/video_embed_field/issues/3279789 💬 Support youtube shorts Needs work

This patch supports formats like

miiimooo Europe

I used the correct site.env just obfuscated here:

terminus -v drush site.env  -- st
...
Drupal version   : 10.3.0                                
Site URI         : http://XXX.pantheonsite.io 
DB driver        : mysql                                 
DB hostname      : dbhost                                
DB port          : 6033                                  
DB username      : XXX      
DB name          : pantheon                              
Database         : Connected                             
Drupal bootstrap : Successful                            
Default theme    : XXX                            
Admin theme      : XXX                                 
PHP binary       : /opt/pantheon/php8.3/php              
PHP OS           : Linux                                 
PHP version      : 8.3.9                                 
...
miiimooo Europe

Thanks for the support.

I tried this, the output is just

Headers: {"User-Agent":"Terminus/3.1.4 (php_version=8.1.2-1ubuntu2.18&script=XXX/terminus)","Accept":"application/json","Authorization":"**HIDDEN**"}
URI: https://terminus.pantheon.io:443/api/sites/XXX/environments
Method: GET
Body: null
 [warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
 [notice] Command: site.env -- drush ev passthru('php core/scripts/drupal recipe modules/custom/mymodule/recipes/testing -v'); [Exit: 0]

The recipe should create a block_content entity, but nothing happens and no log message either

miiimooo Europe

Just created an issue fork, applied the latest patch from @seanB and @gugalamaciek and added a commit that updates the function signature for 10.3 compatibility. Also tested patch and the widget and still works

miiimooo Europe

Adding a re-roll of the patch in #13 for 2.1.0

The patch in #27 adds some check which is not part of this patch

miiimooo Europe

Hi @arnalyse, I think it should be possible to roll your own using this

https://github.com/Lullabot/storybook-drupal-addon/blob/8a6690e09f6471b9...

and this https://github.com/Lullabot/storybook-drupal-addon/blob/main/src/manager.ts together with the guide on writing plugins

The folks at lullabot and e0ipso might be better at helping with this

miiimooo Europe

The solution outlined in #3362451-16: [upstream] [Style] Allow CKEditor 5 to *create* a

directly (instead of first

, then adding a class) → works, thanks @aludescher

To summarize, it uses a core patch to allow any tag in the ckeditor5 heading plugin, not just PS. in my use case I added an option for support for formatted text. I tried to add that then in the custom list for source editing tags so the editor wouldn't just remove them. But the text format configuration was clever and produced an error on save, since the tag is already supported by the CodeBlock ckeditor5 plugin. As a workaround I found out adding the tag with an arbitrary class bypasses that check and makes any tag work that is added in the alter hook.

miiimooo Europe

Tracing this down my entity_embed/embed stack..

miiimooo Europe

@arnalyse thanks for this fix. It allows to select a different theme from the site default theme like this:

# .storybook/preview.js

/** @type { import('@storybook/server').Preview } */
const preview = {
  globals: {
    _drupalTheme: 'my_theme',
  },
  parameters: {
...
miiimooo Europe

miiimooo changed the visibility of the branch preview_link-3124785-reroll-68f89a1 to hidden.

miiimooo Europe

Consider a case where there is a lot of legacy content that has embedded JS and that you add CSP to in order to improve security.

In this case, you currently have to allow things like `script-src 'unsafe-inline'` globally, and other things like JS libraries that are loaded from CDNs for instance.

If it was possible to override this on a per-page basis, the security situation would be much better

miiimooo Europe

Attached is a patch that sets responses from the preview link controller to max-age=0, making them un-cacheable.

I'm open for better suggestions but in many cases this will be the desired behaviour. The impact on performance should negligible as preview-links are mainly shared in smaller groups

miiimooo Europe

miiimooo changed the visibility of the branch 3.x to hidden.

miiimooo Europe

miiimooo changed the visibility of the branch 8.x-3.x to hidden.

miiimooo Europe

miiimooo changed the visibility of the branch 3416902-port-3.x-for to hidden.

miiimooo Europe

miiimooo changed the visibility of the branch 3416902-port-3-drupal10 to hidden.

miiimooo Europe

This works but referencing the commit instead of a working branch is ugly and really should avoided.

The underlying problem is that in 3.x two more commits were added (109da268 and 15ebbd47).

The first one of them introduces breaking changes since it moves everything from build/ to dist/

I would argue that this change warrants a new branch and that it should be removed from 3.x

The second change makes a path change which I'm not convinced it is required by 9.5

Please remove this also from the 3.x branch. Unless you can find a reference where the reason for this change is documented

miiimooo Europe

I spoke to soon. After upgrade to D10 I realised that dev-4.x already includes a lot of the refactoring.

Here is the D10 patch re-rolled for 3.0-alpha1

miiimooo Europe

The work for this was already done in the 3.x and 4.x branches.

This seems to work for now:

composer require drupal/components:'dev-3.x as 2.4.1'
composer require drupal/prototype:dev-4.x
miiimooo Europe

Lower priority since doing this in the UI and exporting to config (stabel->stable9 in core.extension.yml) works

miiimooo Europe

Here a quickfix if you need to add this in your project while there is no progress on this issue (since ckeditor4 is deprecated I doubt there will be much progress)

    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "ckeditor-plugin/a11ychecker",
                "version": "1.1.1",
                "type": "drupal-library",
                "dist": {
                    "url": "https://download.ckeditor.com/a11ychecker/releases/a11ychecker_1.1.1.zip",
                    "type": "zip"
                }
            }
        }
composer require ckeditor-plugin/a11ychecker

Check your (web/)libraries folder for presence of the a11ychecker folder

miiimooo Europe

+1 from me for this patch.

I have added an example project that is useful when there are many languages installed on a site here https://www.drupal.org/sandbox/miiimooo/3414705

The project depends on this patch at the moment

miiimooo Europe

@plopspec thanks for reviewing. I've added the post_update hook now as you suggested now and confirmed it's working

miiimooo Europe

Thanks for reviewing @marcelovani . I'm not sure I made it clear enough what this simple patch achieves. In addition to what the module does so far, that it allows selecting from a list of paragraph types, it makes it possible to preset a paragraph type in an entity embed button in the editor. This works really well. The change is also minimal but maybe needs better documentation.

Use case 1 (original)


this is still supported and works like before

Use case 2 (added by patching)


This is the new functionality.
When using this embed, ckeditor jumps directly to the entity add form of the bundle

Okay, the title could be improved..

miiimooo Europe

I can confirm that the errors in Google Search Console are gone.

miiimooo Europe

@ben.hamelin Have you tested wit the re-rolled patch from #96? I did that re-roll because previous patches were broken after upgrading to 10.1

miiimooo Europe

Updated the patch to add a check for when getRouteName returns NULL (e.g. running in cron)

miiimooo Europe

This changes also the temporary://path_redirect_import/migrate.csv in the migrate yaml config

Production build 0.71.5 2024