Unable to open Theme settings on UI in Drupal 10

Created on 23 June 2023, almost 2 years ago
Updated 17 August 2023, almost 2 years ago

Problem/Motivation

As , I installed the theme I opened the settings of the theme but it is giving me the following error:

TypeError: array_search(): Argument #2 ($haystack) must be of type array, string given in array_search() (line 894 of core/themes/claro/claro.theme).

Steps to reproduce

Need to fix the following error in the code as the class slide-show used in the .theme file is conflicting with the admin claro theme .

For better understanding of the error I am attaching the screenshot below:

🐛 Bug report
Status

Active

Version

9.1

Component

Code

Created by

🇮🇳India Prachi6824

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

Comments & Activities

  • Issue created by @Prachi6824
  • 🇮🇳India Prachi6824

    When I changed the admin theme with other admin themes then theme settings are opened but is has issues with the Claro as admin theme .As, I opened the theme settings with claro as the admin theme it is giving the error .

  • Assigned to anchal_gupta
  • Issue was unassigned.
  • 🇺🇸United States texasintegratedservices

    In core/themes/claro/claro.theme
    Change Line 1006

    // Remove 'container-inline' class from the main attributes and add a flag
    // instead.
    // @todo remove this after https://www.drupal.org/node/3059593 has been
    // resolved.
    if (!empty($variables['attributes']['class'])) {
    if(is_array($variables['attributes']['class'])){ <-------------------Added
    $container_inline_key = array_search('container-inline', $variables['attributes']['class']);

    if ($container_inline_key !== FALSE) {
    unset($variables['attributes']['class'][$container_inline_key]);
    $variables['inline_items'] = TRUE;
    }
    }<-------------------Added
    }

  • 🇺🇸United States texasintegratedservices

    if (!empty($variables['attributes']['class'])) {
    // Convert to array if it's a string
    if (is_string($variables['attributes']['class'])) {
    $variables['attributes']['class'] = explode(' ', $variables['attributes']['class']);
    }

    if (is_array($variables['attributes']['class'])) {
    $container_inline_key = array_search('container-inline', $variables['attributes']['class']);

    if ($container_inline_key !== FALSE) {
    unset($variables['attributes']['class'][$container_inline_key]);
    $variables['inline_items'] = TRUE;
    }
    }
    }

Production build 0.71.5 2024