$layout_config deprecated - FIX

Created on 19 December 2023, about 1 year ago
Updated 12 February 2024, 11 months ago

On upgrade to Drupal 10.2 it threw error

Deprecated function: Creation of dynamic property Drupal\at_core\Layout\LayoutLoad::$layout_config is deprecated in Drupal\at_core\Layout\LayoutLoad->__construct() (line 36 of themes/adaptivetheme/at_core/src/Layout/LayoutLoad.php).

FIX ADD protection at line 36 of LayoutLoad.php as below

* The active regions on page load.
*/
protected $active_regions;

+ /**
+ * The layout config on page load.
+ */
+ protected $layout_config;

/**
* LayoutInterface constructor.

🐛 Bug report
Status

Fixed

Version

5.0

Component

Miscellaneous

Created by

🇺🇸United States bobburns

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

Comments & Activities

  • Issue created by @bobburns
  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India viren18febS

    Hi @bobburns
    I have added a patch for the changes , please review
    Thanks

    • 133ab350 committed on 8.x-5.x
      Issue #3409851 by viren18febS: $layout_config deprecated - FIX
      
  • This has been fixed and will make its way into a new release later today.

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • 🇩🇰Denmark uv516 Denmark

    I have updated AdaptiveTheme to v. 8.x-5.2 and today I updated Drupal to v. 10.2.2 (PHP v. 8.2.15).
    I got similar errors as above:
    Deprecated: Creation of dynamic property Drupal\at_core\Layout\Layout::$layout_path is deprecated in /var/www/[my_site]/themes/contrib/adaptivetheme/at_core/src/Layout/Layout.php on line 27

    The same error for $layout_cid.
    I added line 17 and 18:

      protected $layout_path; // <- new 2024-01-21
      protected $layout_cid; // <- new 2024-01-21
    

    All variables in a class should be forwarded.

  • I had the same error as in comment 8 and created a patch.

  • 🇩🇰Denmark uv516 Denmark

    The same issue in "themes\contrib\adaptivetheme\at_core\src\Layout\LayoutSubmit.php":

    protected $theme_name;
    
      /**
       * Form state values.
       */
      protected $values;
    +  protected $layout_config;
    +  protected $css_config;
    +  protected $layout_name;
    +  protected $layout_path;
    +  protected $form_values;
    
Production build 0.71.5 2024