Brussels
Account created on 3 October 2008, over 16 years ago
  • Drupal developer at iO 
#

Merge Requests

Recent comments

🇧🇪Belgium ludo.r Brussels

I have a content type with 150+ custom fields and some nodes that have dozens of revisions.
When loading revisions when exporting, this causes memory issues and also a long time to export.

Changing this (in modules/single_content_sync_revisions/src/ExportSubscriber.php):

      // Second step is exporting those revisions.
      /** @var \Drupal\Core\Entity\ContentEntityInterface $revision */
      foreach ($storage->loadMultipleRevisions($revision_ids) as $revision) {

to:

      // Second step is exporting those revisions.
      foreach ($revision_ids as $revision_id) {
        /** @var \Drupal\Core\Entity\ContentEntityInterface $revision */
        $revision = $storage->loadRevision($revision_id);

solves the memory issues and makes the process much faster.

🇧🇪Belgium ludo.r Brussels

Here's a version that works with 1.0.2

🇧🇪Belgium ludo.r Brussels

It seems, my custom URL processor is being called event when the facet source is set to use the default one.

Anyone encountered this issue?

🇧🇪Belgium ludo.r Brussels

Thanks for the help, I managed to do it by extending the leaflet prototype:

/**
 * @file JavaScript
 */

(function ($, Drupal, drupalSettings, L) {

  Drupal.behaviors.MapLeafletInteraction = {
    attach: function (context, settings) {
      if (typeof Drupal.Leaflet !== 'undefined' && typeof Drupal.Leaflet.prototype.create_feature !== 'undefined') {
        // Save the original function that we will override.
        var originalCreateFeature = Drupal.Leaflet.prototype.create_feature;

        // Override the original create_feature function.
        Drupal.Leaflet.prototype.create_feature = function (feature) {
          // Call the original function.
          var lFeature = originalCreateFeature.call(this, feature);

          // Add sidebar to the lFeature.
          this.feature_bind_sidebar(lFeature, feature);

          return lFeature;
        };

        /**
         * Add sidebar feature to the Leaflet Feature.
         *
         * @param lFeature
         * @param lFeature
         *   The Leaflet Feature
         * @param feature
         *   The Feature coming from Drupal settings.
         */
        Drupal.Leaflet.prototype.feature_bind_sidebar = function(lFeature, feature) {
          let entity_id = feature.entity_id;
          lFeature.on('click', function(e) {
            loadNodeContent(entity_id);
          });
        };
      }
    }
  };

  function loadNodeContent(entity_id) {
    const endpoint = `/ajax-view/node/${entity_id}/overview/en?_wrapper_format=drupal_ajax`;
    const ajaxSettings = {
      url: endpoint,
      event: 'click', // This event type is required but won't be used
      progress: {
        type: 'throbber'
      },
      wrapper: '#map-sidebar' // Target div selector
    };

    // Create a new Drupal.ajax instance and execute it immediately.
    const ajax = new Drupal.ajax(ajaxSettings);
    ajax.execute();
  }

})(jQuery, Drupal, drupalSettings, L);

And I have a custom controller that returns the response.

🇧🇪Belgium ludo.r Brussels

I fixed a bug when text is empty, based on patch #46.

🇧🇪Belgium ludo.r Brussels

Patch #31 seems to work on our side (Using version 4.1.0).

I also agree with suggestion in #28, to have both options (white/black-list).

🇧🇪Belgium ludo.r Brussels

We're experiencing this issue also on Drupal 10.2.8.
Seems also that when this happens, content is lost upon save.

I think this should be major issue.

🇧🇪Belgium ludo.r Brussels

ludo.r made their first commit to this issue’s fork.

🇧🇪Belgium ludo.r Brussels

Added some code in MR:

  • Initialize options column to an empty array instead of NULL when installing schema
  • Update all menu_link related tables (including revision tables) to an empty array when value is NULL
🇧🇪Belgium ludo.r Brussels

I'm using this module that I copied as a custom module and just changed the version in the info file if I remember correctly.

🇧🇪Belgium ludo.r Brussels

My guess (and I bet), that there's a good reason for that.

Imagine a seach page (99% a views page), where you come with a specific parameter in the URL for Facet A.
Facet B has no result with param for Facet A.

If you have an ajax view and uncheck param in Facet A, you might need to show results in Facet B.
That's a good reason to use the hidden class rather than not showing the block at all.

Btw, IMHO, I think the hidden class can be used by anyone (theme, contrib module), it's feature of Drupal.

🇧🇪Belgium ludo.r Brussels

Just tested patch #6, it indeed returns an empty block.

However, I removed the patch, as I see that the default behavior of facets module is to show the block but add the hidden class.
So I think there must be a reason for that.

In the end it's just our theme that overrides the hidden class, we'll fix it with css and respect when hidden is being added.

See https://git.drupalcode.org/project/facets/-/blob/3.0.x/facets.module?ref...

🇧🇪Belgium ludo.r Brussels

Patch in comment #18 works on my side with version 2.0.7

🇧🇪Belgium ludo.r Brussels

Here's the patch.

🇧🇪Belgium ludo.r Brussels

Ludo.R created an issue.

🇧🇪Belgium ludo.r Brussels

Patch #7 works with Drupal 10.2.7

🇧🇪Belgium ludo.r Brussels

Patch #11 works, however it seems there's an issue with the form option.
It doesn't get saved as expected (gets saved with null value).

I had to set myself the render_source property to FALSE in the config.

🇧🇪Belgium ludo.r Brussels

I did succeed to make it work by using a custom module just to handle AJAX loading of webforms.

See:

Basically you need a custom module with a custom route, and then trigger the AJAX loading through javascript.

🇧🇪Belgium ludo.r Brussels

Hello,

Patch #17 works fine.

For the ones like me who didn't know how it works:
This patch creates a new field under the file entity itself called "Search API attachments: extracted file".

This is Node => Paragraph => Media => File:

field_downloads:entity:field_files:entity:field_media_file:entity:search_api_attachments_extracted_file

🇧🇪Belgium ludo.r Brussels

I confirm it works.

🇧🇪Belgium ludo.r Brussels

This patch is the same as #7, but adds an update hook to udpate:

  • Patterns using the old token, to replace it with the new one
  • Pathauto settings safe tokens to the old token with the new one
🇧🇪Belgium ludo.r Brussels

Add missing menu_trail_by_path.services.yml, do not use patch #15.

🇧🇪Belgium ludo.r Brussels

Totally agree, didn't know about this module, just tested it and it works for my use case.

Closing the issue.

🇧🇪Belgium ludo.r Brussels

Here's the patch with test coverage, this is now against Drupal 11.x, functions are typehinted.

Will create a MR.

🇧🇪Belgium ludo.r Brussels

Here's an updated patch with PHPCS fix.

@smustgrave, what new functions are you referring to?
All functions in there are inherited, or documented in interfaces. Also I don't see any example in https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/node/..., which is was my example.

🇧🇪Belgium ludo.r Brussels

Code is exactly the same, just fixed some typos in comments.

🇧🇪Belgium ludo.r Brussels

Here's the new plugin.

This plugin should work without any problem with D10/D9.

🇧🇪Belgium ludo.r Brussels

Patch that combines following patches:

Works with menu_trail_by_path 2.0.1.

🇧🇪Belgium ludo.r Brussels

Previous patch was missing a use statement, don't use #24.

🇧🇪Belgium ludo.r Brussels

Patches in #19 and #20 do not pursue the same goal.

I'm re-rolling patch #19 for version 2.x-dev.

🇧🇪Belgium ludo.r Brussels

Patch re-rolled against 8.x-2.x-dev

🇧🇪Belgium ludo.r Brussels

Patch #5 works for version 8.x-3.6.

However if you work with an older version of PHP (7.3 in my case) it's broken.

Here's a version where I remove the typed property to make it work: protected ?int $depth; => protected $depth;

🇧🇪Belgium ludo.r Brussels

Fixed by d.vandoninck

🇧🇪Belgium ludo.r Brussels

This has been fixed on 1.0.x

🇧🇪Belgium ludo.r Brussels

@AnjaliPrasannan,

You won't be able to reproduce unless you have API credentials for this service. And I don't think they provide free access.

🇧🇪Belgium ludo.r Brussels

Re. #27

I just ran into the same issue, I guess modifying MenuBlock::getDerivativeActiveTrailIds() should be enough.

  protected function getDerivativeActiveTrailIds() {
    $menu_id = $this->getDerivativeId();

    // => If menu_id = "multiple_menu_block", then do custom logic.

    return array_filter($this->menuActiveTrail->getActiveTrailIds($menu_id));
  }

In the meantime I'm using classic Menu blocks (from core) and not the multiple one.

🇧🇪Belgium ludo.r Brussels

For me it worked like this:

Add this to composer.json

    "extra": {
        "merge-plugin": {
            "include": [
                "[web-root]/modules/contrib/ckwordcount/composer.libraries.json"
            ]
        }
    }

And then

composer require drupal/ckwordcount and not composer require drupal/ckwordcount w8tcha/ckeditor-wordcount-plugin.

🇧🇪Belgium ludo.r Brussels

I have the same issue as @yannickoo

Patch #43 seems to work correctly.

🇧🇪Belgium ludo.r Brussels

An option to skip failed items would nice too :)

🇧🇪Belgium ludo.r Brussels

Here's an adapted version of #19 that fixes the <html><body> issue, however I'm sure there is a safer/better way to do this.
This should still be improved IMO.

🇧🇪Belgium ludo.r Brussels

Using patch #19 (didn't try more recent patches) is producing incorrect HTML.

It ends up with <html><body>[processed text here]</body></html>.

🇧🇪Belgium ludo.r Brussels

Patch from the merge request on #27 didn't work for with version 4.0.0-beta4.

I adapted the patch.

🇧🇪Belgium ludo.r Brussels

Turns out I had to rename the files from d7_webform.yml to migrate_plus.migration.d7_webform.yml.

It solved the issue in my case.

🇧🇪Belgium ludo.r Brussels

Strange thing: just tried to import config through the UI (by copy/pasting the exact same config) and this works.

🇧🇪Belgium ludo.r Brussels

It appears that this happens with content_moderation module enabled, on the moderation_state field.

For now I circumvented this issue like this:

    // Clone the field.
    $original_field = $data['field'];
    if (method_exists($original_field, 'createDuplicate')) {
      // Do stuff.
    }
🇧🇪Belgium ludo.r Brussels

Tested with patch #14 on D10, seems to work without any problem, with all submodules enabled.

🇧🇪Belgium ludo.r Brussels

Patch providing D10 support.

Remarks:

🇧🇪Belgium ludo.r Brussels

It seems the only change left is the version requirement in .info.yml file.

Tested on D10, everything looks fine.

🇧🇪Belgium ludo.r Brussels

As per https://www.drupal.org/node/3126004 , method has been changed from guess() to guessMimeType().

As recommended, I added a condition to make it work with both D8/9 and D10.

🇧🇪Belgium ludo.r Brussels

This patch should solve the problem.
There might be more underlying issues to solve but it will get the translated titles to be displayed.

🇧🇪Belgium ludo.r Brussels

#20 works on my side and my use case, but I guess it's worth to mention that it does not exactly what the option claims:

Use the current entity language to generate a url (rather than the language of the referenced entity)

In fact it just gets the current language page rather than the referencing entity language.
This might be a problem if you want to show items in other languages than the current page language.

🇧🇪Belgium ludo.r Brussels

Although PHP7.4 is not recommended, it is still supported by Drupal >= 9.4: https://www.drupal.org/docs/system-requirements/php-requirements#versions

IMO, support for PHP version should follow Drupal core's support.

🇧🇪Belgium ludo.r Brussels

@tra.duong,

Thanks for pointing this!

Regarding the core version, I left the old core property so that I can work with older D8 versions:
core: 8.x
core_version_requirement: ^8 || ^9 || ^10

For the menu_link module, I guess we'll have to wait for the D10 release: https://www.drupal.org/project/menu_link/issues/3322201 📌 Drupal 10 compatibility Fixed
So indeed, the module cannot be installed on D10 yet because of the dependency.

Production build 0.71.5 2024