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. When building a webform and saving elements the succes message is rendered behind the drupal sidebar

    Fons

    Problem/Motivation

    When building a webform and saving elements the succes message is rendered behind the Drupal sidebar.

    This is the topic for another discussion but I've always wondered why Webform has it's own way of showing messages instead of using the standard way that is provided in Drupal.

    Steps to reproduce

    Build a webform, add some form elements and click the save elements button.

  2. [5.0.0-alpha3] Menu items do not get is-active class

    Sven Decabooter

    I applied the MR logic from #3508748: [2.0.x] Add ability to track active menu items in menu source. Then in ui_suite_daisyui:menu component, I add a check:

    {% if item.in_active_trail %}
          <!-- Try adding extra class here -->
    {% endif %}
    

    That doesn't seem to work... Maybe I'm missing some additional context

  3. Support Drupal core DefaultContent API

    Sven Decabooter

    OK it should be possible after all I think.

    Say we can integrate with the contrib Default Content module, to produce output as follows:

    field_logos:
        -
          logo:
            entity_type: 'media'
            entity: eab657e0-3320-41d2-ab4e-53a09b397758
          link: 'https://google.com'
          link__title: ''
          link__options: { }
    

    (if not possible, worst case we need to document the exported YAML files have to be manually edited).

    Then in CustomFieldEntityReference::setValue(). we can do something like:

      /**
       * {@inheritdoc}
       */
      public function setValue($value, $notify = TRUE): void {
        $entity = $value['entity'] ?? NULL;
        // START ADDED LOGIC.
        if (is_array($value)) {
          if ($value['entity_type'] && Uuid::isValid($value['entity'])) {
            $entity = \Drupal::entityTypeManager()->getStorage($value['entity_type'])->loadByProperties(['uuid' => $value['entity']]);
            $entity = !empty($entity) ? current($entity) : NULL;
          }
        }
        // END ADDED LOGIC.
        if ($entity instanceof EntityInterface) {
          ...
       }
    

    I can spend some time to look further into this, but am currently time restrained, so just doing some braindump here. Will try to elaborate on it next week. Let me know if it would be a workable solution to extend the setValue() logic, for the use case of default content exports / imports.

  4. Support Drupal core DefaultContent API

    Sven Decabooter

    Did some more digging, and it seems the datatype used in custom_field module is "CustomFieldEntityReference", which does not inherit from core "EntityReference" data type, so guess this will never work :'(

  5. Support Drupal core DefaultContent API

    Sven Decabooter

    Problem/Motivation

    I have created a custom_field instance with the following properties: - logo: entity reference to Media entity - link: link field

    In a recipe, I'm using the Drupal core DefaultContent API to add default content upon application of the recipe. However, this does not work well with the custom_field I have.

    When I export the node containing this field (with the contrib Default Content module), I get something like:

    field_logos:
        -
          logo: 14
          link: 'https://google.com'
          link__title: ''
          link__options: { }
    

    Obviously directly linking to media ID 14 won't work, because the recipe will be installed on a site that might have different auto-increment IDs.

    I tried editing this to use the entity UUID, like other entity references exported via Default Content module:

    field_logos:
        -
          logo: eab657e0-3320-41d2-ab4e-53a09b397758
          link: 'https://google.com'
          link__title: ''
          link__options: { }
    

    This doesn't work either.

    Looking deeper into the core Importer class (\Drupal\Core\DefaultContent\Importer::setFieldValues()), I notice this only works for EntityReference data types: if ($property instanceof EntityReference) { ... } (full namespace = Drupal\Core\Entity\Plugin\DataType\EntityReference)

    I'm not familiar enough with the data model of custom_module, but I assume this uses something custom, instead of the core EntityReference data type, and thus does not set the value correctly. Would there be any way to make this work (without hacking core I presume)?

  6. Compatibility with block_uuid storage patch

    Sven Decabooter

    Problem/Motivation

    I am using the core patch #3180702: Export block UUID with custom Layout Builder blocks to store a block UUID in config, to allow Layout Builder blocks to be added via default_content export / import functionality.

    This does not work together with the logic in this module. The blocks do get translated via AI, but the translation is not correctly saved.

    Steps to reproduce

    Try this module with the patch mentioned above applied.

    Proposed resolution

    Some conditional logic could be added to make this work for sites that have this patch applied, while still working as expected for most sites that wouldn't have this patch applied.

  7. AI Translate: controller override not triggered if installed via recipe

    Sven Decabooter

    Problem/Motivation

    I enable and configure the ai_translate module via a recipe. After recipe installation, the translation controller is not overridden, so not showing the "Translate using ..." link.

    When explicitly saving the configuration form, it does work. Seems like this is triggered by \Drupal\ai_translate\Form\AiTranslateSettingsForm::submitForm. But upon recipe installation, this does not get triggered...

    Steps to reproduce

    Install the module via a recipe, and try to translate a content item.

  8. Wrong URL in ai_translate documentation

    Sven Decabooter

    Merge request added. This probably also can be committed to 1.0.x and 1.2.x branch, but I made the MR against 1.1.x, since I'm actively working with that branch.

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.