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. Install Tocbot library with composer

    Fons

    Problem/Motivation

    It would be nice if we could add the steps to add the Tocbot library that is used by this module with composer.

    Proposed resolution

    Update the Readme file and project detail page on drupal.org

    Remaining tasks

    Create a patch, if you are open to this suggestion I don't mind creating and posting the patch. -> Patch in comments

    As I see it now the following steps are needed:

    INSTALLATION VIA COMPOSER

    1. It is assumed you are installing Drupal with Composer (https://www.drupal.org/download).

    2. Add the following entry in the "repositories" section of your main composer.json file.

    {
                "type": "package",
                "package": {
                    "name": "tscanlin/tocbot",
                    "version": "4.30.0",
                    "type": "drupal-library",
                    "source": {
                        "url": "https://github.com/tscanlin/tocbot",
                        "type": "git",
                        "reference": "v4.30.0"
                    }
                }
            }
    

    Now you can run the following command to install chosen in the right folder:

    composer require tscanlin/tocbot

    3. Clear the cache 4. Go to Administration > Configuration > Content Authoring > Tocbot Settings (/admin/config/content/tocbot) 5. Configure the module to your needs 6. Click "Save configuration"

  2. Blazy renders the same classes on all blazy elements on a page.

    Fons

    Dear gausarts, thank you for the compliment and sorry to read that.

    Just a thought:

    If we would toggle this setting by default in the install file of the module it would only trigger / set it default for new installs.

    Existing installs wouldn't be affected, if you want to affect those (which you don't and I totally get that) you would add this in an update hook.

    If you are interested in a patch for the install file i'd be happy to make it but it is not a dealbreaker for me.

    Thank you for all your work and have a great evening! There are a lot of good people out there so try to focus on those, that may help!

  3. Blazy renders the same classes on all blazy elements on a page.

    Fons

    Thank you for your reply, I checked the Blazy settings page but it seems that I read over the checkbox to disable these classes.

    I just checked the setting and everything looks better / clean now.

    If I may suggest an upgrade I think it's fair to check this setting by default as a clean DOM is preffered over all these classes in most cases but that is just my view.

    Thanks!

  4. Blazy renders the same classes on all blazy elements on a page.

    Fons

    I created a patch that cleans out the function so the DOM is now a lot less bloated with unneeded classes.

    I might miss the point why all these classes are added on every media element but they are not needed for the module to work and I don't see the value they add.

    Feel free to enlighten me.

  5. Blazy renders the same classes on all blazy elements on a page.

    Fons

    Problem/Motivation

    I'm using blazy on a page in different layout blocks.

    I've noticed the blazy field gets injected with the same classes for all media fields which to me makes no sense.

    Steps to reproduce

    Create a page with multiple blazy elements, you'll notice the same group of classes is used on all elements instead of the relevant classes per item.

    Proposed resolution

    Don't make a huge group of classes and render them on all elements but instead only show the relevant classes per item.

    The classes are added in an array in the following file:

    blazy/src/Attributes.php

    in the following function:

    /**
       * Returns the classes applicable only to the first, not nested containers.
       */
      private static function firstClasses(array &$attributes, $blazies, array $options): array {
    

    If you print the classes before the return you'll see the same array that is printed for every item.

    Remaining tasks

    Needs review

  6. Header is always shown in Claro even when regions in it are empty

    Fons

    Problem/Motivation

    The header of Claro is always rendered even when the regions (page.breadcrumb & page.header) are have no content in it.

    Because of this the background and the background color of the header is always rendered which is odd.

    Steps to reproduce

    Assign no content to the breadcrumb and header regions in Claro, you'll see the background is show on screen.

    Proposed resolution

    Add a check to see if one of the regions (breadcrumb or header) is filled, if not don't render the header at all.

  7. Error on disabling the "navigation_layout"

    Fons

    So for reasons beyond my control the "navigation_layout" seems to exist (core module navigation) and is something that is considered needed.

    If that's the case it would be best to alter this module so you can't disable it (since it will throw the error I mention).

    For now I disabled this module and disabled / hide the layouts with the following code in case somebody has the same problem as I do.

    In this example I hide all the layouts except the one col layout.

    /**
     * Implements hook_layout_alter().
     */
    function YOUR_MODULE_layout_alter(&$definitions)
    {
        // an array of layouts to keep.
        $layoutsWhitelist = ['navigation_layout'];
    
        // layouts that are required and cannot be removed.
        $requiredLayouts = ['layout_onecol', 'layout_builder_blank'];
    
        $layouts = array_merge($requiredLayouts, $layoutsWhitelist);
        
        $definitions = array_filter(
            $definitions,
            static fn(string $id) => in_array($id, $layouts, true),
            ARRAY_FILTER_USE_KEY
        );
    }
    
    /**
     * Implements hook_preprocess_item_list__layouts().
     */
    function YOUR_MODULE_preprocess_item_list__layouts(&$variables)
    {
        // For some reason removing this layout breaks the website so we hide it.
        $layoutToHide = ['navigation_layout'];
    
        $variables['items'] = array_filter(
            $variables['items'],
            static fn(string $id) => !in_array($id, $layoutToHide, true),
            ARRAY_FILTER_USE_KEY
        );
    }
    
  8. Error on disabling the "navigation_layout"

    Fons

    Problem/Motivation

    I disabled some layouts using this module which works fine.

    When hiding the navigation_layout an error is thrown:

    The website encountered an unexpected error. Try again later.
    
    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "navigation_layout" plugin does not exist. Valid plugin IDs for Drupal\Core\Layout\LayoutPluginManager are: layout_onecol, layout_twocol_bricks, layout_threecol_25_50_25, layout_threecol_33_34_33, layout_builder_blank in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

    Seems like the navigation_layout does not exist but I do see it when using layout builder (see screenshots in attachment).

    Steps to reproduce

    Disable the navigation_layout

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.