Icons don't show up if theme is not subtheme of "stable"

Created on 14 November 2017, over 7 years ago
Updated 22 August 2023, over 1 year ago

Problem/Motivation

This module relies on a core's bug that automatically assigned classes to <li> items based on the keys of the links array.

After #2402165: #theme => 'links' renders

  • when the #links array is not associative → this was fixed, so this module doesn't render the icons, unless the theme being used is a subtheme of stable, where a backwards-compatibility layer was added:

    /**
     * Implements template_preprocess_links().
     */
    function stable_preprocess_links(&$variables) {
      // @deprecated in Drupal 8.0.x and will be removed before 9.0.0. This feature
      // of adding a class based on the associative key can cause CSS class name
      // conflicts.
      if (!empty($variables['links'])) {
        foreach ($variables['links'] as $key => $value) {
          if (!is_numeric($key)) {
            $class = Html::getClass($key);
            $variables['links'][$key]['attributes']->addClass($class);
          }
        }
      }
    }
    

    This is the result if you are using a theme which is not sable-based:

    Proposed resolution

    Remaining tasks

    User interface changes

    API changes

    Data model changes

  • 🐛 Bug report
    Status

    Needs work

    Version

    1.0

    Component

    Code

    Created by

    🇪🇸Spain marcoscano Barcelona, Spain

    Live updates comments and jobs are added and updated live.
    Sign in to follow issues

    Comments & Activities

    Not all content is available!

    It's likely this issue predates Contrib.social: some issue and comment data are missing.

    • 🇫🇷France matoeil

      adding the links to olivero solve the problem as long as content translation is not used

      function child_preprocess_links(&$variables) {
        if (!empty($variables['links'])) {
          foreach ($variables['links'] as $key => $value) {
            if (!is_numeric($key)) {
              $class = Html::getClass($key);
              $variables['links'][$key]['attributes']->addClass($class);
            }
          }
        }

      When trying to edit paragraphs on a fr or en version of one content , the modifications affect both versions ( 1revision for each language is created)
      Are these links language aware ?

    Production build 0.71.5 2024