Een hart voor de Drupal Community

Bij make it fly geloven we sterk in Drupal en Open Source software in het algemeen. We maken dagelijks gebruik van vele open source componenten en de vele Drupal modules die beschikbaar zijn. We dragen actief ons steentje bij aan de community door zelf patches, modules en documentatie te voorzien, daarnaast zijn enkele teamleden ook actief in de Drupal User Group vzw.

Een overzicht van onze bijdragen aan de Drupal community vind je terug op onze Drupal.org pagina. Naast het actief meerwerken aan de Drupal community, zetten we ook andere ontwikkelaars op weg door vragen te beantwoorden op Drupal Answers.

  1. Error: Call to undefined function layout_builder_form_entity_form_display_edit_form_alter() in layout_builder_at_form_entity_form_display_edit_form_alter() (line 56 of /web/modules/contrib/layout_builder_at/layout_builder

    Fons
    Fons added a comment on drupal.org: Error: Call to undefined function layout_builder_form_entity_form_display_edit_form_alter() in layout_builder_at_form_entity_form_display_edit_form_alter() (line 56 of /web/modules/contrib/layout_builder_at/layout_builder
  2. Error: Call to undefined function layout_builder_form_entity_form_display_edit_form_alter() in layout_builder_at_form_entity_form_display_edit_form_alter() (line 56 of /web/modules/contrib/layout_builder_at/layout_builder

    Fons
    Fons added a comment on drupal.org: Error: Call to undefined function layout_builder_form_entity_form_display_edit_form_alter() in layout_builder_at_form_entity_form_display_edit_form_alter() (line 56 of /web/modules/contrib/layout_builder_at/layout_builder
  3. Error: Call to undefined function layout_builder_form_entity_form_display_edit_form_alter() in layout_builder_at_form_entity_form_display_edit_form_alter() (line 56 of /web/modules/contrib/layout_builder_at/layout_builder

    Fons

    Problem/Motivation

    The module seems to call a function that doesn't exist anymore in Drupal 11.

    Steps to reproduce

    1. Install a Drupal 11 website
    2. Install the latest layout_builder_at module (Mine is patched see below)
    3. Create a block type to use in layout builder
    4. Go to the form display of this block, the error hits

    Patch:

    "drupal/layout_builder_at": {
        "#3431569: Drupal 11 compatibility": "https://www.drupal.org/files/issues/2024-10-18/D11-compatibility-3431569-8.patch"
    },
    

    Remaining tasks

    Look for a solution for the code at layout_builder_at.module line 56:

    if ($hide) {
        layout_builder_form_entity_form_display_edit_form_alter($form, $form_state);
    }
    
  4. Error: Call to undefined function layout_builder_form_entity_form_display_edit_form_alter() in layout_builder_at_form_entity_form_display_edit_form_alter() (line 56 of /web/modules/contrib/layout_builder_at/layout_builder

  5. Masquerade by URL doesn't work

    Randal

    Hi @julianriemersma,

    Sorry for the delay, I'll try to take a look into this ASAP. I think something else might be wrong still, it's normal the authenticated role can't be chosen (since you *need* that role to use Masquerade by Role), but it shouldn't deny access when trying to masquerade as authenticated.

    I think I've found a solution but need to do more testing. Will keep you updated.

  6. Add some kind of quota management system

    Bram Goffings

    In the world of agencies it's not uncommon that the web agency manages the API keys of the projects of their clients. The clients pay for a fixed fee and they have a limited amount of API requests for that specific key.

    OpenAI, gemini, ... all have a system of spending limits, but they don't have a system to restrict limits per API key. This makes it hard for an agency to manage abusers.

    It would be really helpfull if you could restrict the number of API calls for a specific API key. API calls and billing are not 100% correlated but it's enough to monitor and limit the usage within a project.

    On top of that, some kind of overview with the number of API calls/month would be needed as well. We could provide some resources to help building this system but it would be nice if we could have input and guidance from the maintainers and the community.

  7. Performance issue with the altSelector method in the SchemaMetatagManager class

    Randal

    Problem/Motivation

    On one of our websites, one that has a lot of available metatags/groups/.., we noticed the node edit page (and a custom entity's edit page) were extremely in loading. Through some profiling with xdebug and xhprof, I've come to the conclusion that the SchemaMetatagManager::altSelector method is the culprit. In our case, it got called 512 times but caused a very noticeable 400 ms delay. After uninstalling schema_metatag locally, the entities' edit pages were fast.

    Proposed resolution

    I'm not 100% certain on what a lasting/stable solution here would be, I think changing this code to the reworked snippet would already be a big step forward.

        /** @var \Drupal\metatag\MetatagManager $metatag_manager */
        $metatag_manager = \Drupal::service('metatag.manager');
        $metatag_groups = $metatag_manager->sortedGroupsWithTags();
    
        $group = '';
        $matches = [];
        $regex = '/:input\[name="(\w+)\[/';
        preg_match($regex, $selector, $matches);
        $id = $matches[1];
        foreach ($metatag_groups as $group_info) {
          if (!empty($group_info['tags'])) {
            if (array_key_exists($id, $group_info['tags'])) {
              $tag = $group_info['tags'][$id];
              $group = $tag['group'];
              break;
            }
          }
        }

    Refreshed/reworked snippet:

      // Add a new property to the manager class.
      protected $metatagGroups;
    
        // Check and fill this property first, and access it directly on succeeding calls.
        if (!isset($this->metatagGroups)) {
          $metatag_manager = \Drupal::service('metatag.manager');
          $this->metatagGroups = $metatag_manager->sortedGroupsWithTags();
        }
    
        $group = '';
        $matches = [];
        $regex = '/:input\[name="(\w+)\[/';
        preg_match($regex, $selector, $matches);
        $id = $matches[1];
        foreach ($this->metatagGroups as $group_info) {
          if (!empty($group_info['tags'])) {
            if (array_key_exists($id, $group_info['tags'])) {
              $tag = $group_info['tags'][$id];
              $group = $tag['group'];
              break;
            }
          }
        }
    

    But I'm open to other suggestions! 😇

  8. Issue with Ajax functionality and Drupal 11

    Fons

    I created a patch with replaces $.trim with .trim() based on the JQuery documentation:

    Note: This API has been deprecated in jQuery 3.5; please use the native String.prototype.trim method instead. Unlike jQuery.trim, String.prototype.trim does not work with types other than strings (null, undefined, Number). Make sure that your code is compatible when migrating.

    Source: https://api.jquery.com/jQuery.trim/#:~:text=Note%3A%20This%20API%20has%2....

    The error is now gone and the functionality works again as it should with AJAX checked.

  9. Issue with Ajax functionality and Drupal 11

    Fons

    I have the same issues in a Drupal 11 environment using the Views Load More module with the following error:

    An error occurred during the execution of the Ajax response: TypeError: $.trim is not a function"

    Your reasoning on where this error comes from seems accurate.

  10. Add more social media link icons

    Sven Decabooter

    Problem/Motivation

    For the Drupal.be I wanted to add links to our Facebook Group & Mastodon account at drupal.community. These do not generate an icon, like Meetup, Linkedin, etc.. do. I guess we can add them to our instance individually, but would be good to get that fixed upstream.

    Maybe we need to make use of the new Icon API in Drupal? https://www.drupal.org/docs/develop/drupal-apis/icon-api

  11. Default tag id and additional IDs no longer return valid IDs.

    Randal

    Problem/Motivation

    In #3450154, the patch added `=== 0` to two of the preg_match comparisons which essentially wrecked this functionality. In our case, this fails in the js code that does this:

      if (additionalConfigInfo.length === 0) {
        gtag('config', config.tagId);
      } else {
        gtag('config', config.tagId, additionalConfigInfo);
      }

    Because the `config.tagId` value is empty.

    Steps to reproduce

    This should be visible as soon as you configure google tag with the google analytics debugger chrome plugin.

    Proposed resolution

    Simply remove the `=== 0` in the comparison so this functionality works again like before.

  12. 8.3.27 triggers error: Class "Drupal\Sniffs\Semantics\FunctionCall" not found

    Sven Decabooter

    Problem/Motivation

    My PHPCS pipeline fails with the new 8.3.27 release. It throws the following error:

    Fatal error: Uncaught Error: Class "Drupal\Sniffs\Semantics\FunctionCall" not found in /root/.composer/vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/PregSecuritySniff.php:22

    When I update the pipeline to use 8.3.26 explicitly, it works again. I have checked the release notes for version 8.3.27, but can't find anything specific that would break it, since these classes were not changed recently.

    Any pointers perhaps?

  13. Offering to co-maintain Layout Builder Asymmetric Translation

    Sven Decabooter

    Problem/Motivation

    I would like to become a co-maintainer of this module to merge the Drupal 11 compatibility patch along with any appropriate RTBC issues and create a D11-compatible release.

    You can view my profile to see my large history of work.

    Proposed resolution

    Review my profile and, if approved, add me as co-maintainer with appropriate permissions to merge code, manage issues, and create releases.

    Remaining tasks

    Add me as co-maintainer for this module.

  14. Automated Drupal 11 compatibility fixes for context

    Fons

    I applied MR 35 as a patch:

    https://git.drupalcode.org/project/context/-/merge_requests/35.patch

    But then the D11 compatibility patch didn't apply anymore after that so I made a new one (in attachment) that does work.

    Apply it after the above patch.

  15. Stable version release?

    Brecht Ceyssens

    Hi d34dman,

    I moved the field formatters to a separate submodule so the core can be easily used by other module like RIFT. Looks stable enough for me now: https://www.drupal.org/project/combined_image_style Updated the module's page and mentioned your module as well.

    Let me know if i can be of any further assistance.

    Kind regards Brecht

Sven Decabooter - Drupal Developer

"Onze teamleden bouwen zelf ook mee aan ons geliefde Drupal, en daar zijn we trots op"

Sven Decabooter
Drupal developer

Betrouwbare technologie, naadloze prestaties. Dat zijn onze Drupal-oplossingen.