Support Drupal 10 and update all use of deprecation in the Bootstrap Layout Builder module

Created on 11 May 2022, over 2 years ago
Updated 17 January 2023, almost 2 years ago

Problem/Motivation

Drupal 10.0 development

Thank you so much for the Drupal Core team

Following with

Drupal 10.0.0 is coming soon. Help us test it today!

A snapshot to allow module and theme developers to test compatibility with the next major release. No upgrade path is provided between alpha releases and many additional changes will be included prior to 10.0.0.

The current composer require status for this module under Drupal 10

composer create-project drupal/recommended-project:10.0.0-alpha4@alpha /var/www/html/sandboxes/drupal10bootstrap_layout_builder
cd  /var/www/html/sandboxes/drupal10bootstrap_layout_builder/

composer config minimum-stability dev 

composer require drupal/bootstrap_layout_builder

is having the following problem

Using version ^2.0 for drupal/bootstrap_layout_builder
./composer.json has been updated
Running composer update drupal/bootstrap_layout_builder
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drupal/bootstrap_layout_builder ^2.0 -> satisfiable by drupal/bootstrap_layout_builder[2.0.0-alpha1, ..., 2.x-dev].
    - drupal/bootstrap_layout_builder[2.0.0-alpha1, ..., 2.x-dev] require drupal/core ^8.7.7 || ^9 -> found drupal/core[8.7.7, ..., 8.9.x-dev, 9.0.0-alpha1, ..., 9.5.x-dev] but the package is fixed to 10.0.0-alpha4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require drupal/bootstrap_layout_builder:*" to figure out if any version is installable, or "composer require drupal/bootstrap_layout_builder:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Further drupal-check on

composer create-project drupal/recommended-project:~9 /var/www/html/sandboxes/drupal9bootstrap_layout_builder

cd /var/www/html/sandboxes/drupal9bootstrap_layout_builder/

composer config minimum-stability dev

composer require drupal/bootstrap_layout_builder

composer require drupal/core-dev:~9 --with-all-dependencies
composer require mglaman/drupal-check --dev
composer require phpspec/prophecy-phpunit:^2 --dev 

php vendor/bin/drupal-check -d web/modules/contrib/bootstrap_layout_builder/

Output:

bootstrap_layout_builder--drupal-check--report.txt

  23/23 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ -------------------------------------------------------------------- 
  Line   bootstrap_layout_builder.install                                    
 ------ -------------------------------------------------------------------- 
  14     Call to deprecated function drupal_get_path():                      
         in drupal:9.3.0 and is removed from drupal:10.0.0. Use              
           \Drupal\Core\Extension\ExtensionPathResolver::getPath() instead.  
 ------ -------------------------------------------------------------------- 

 ------ ----------------------------------------------------- 
  Line   src/BreakpointListBuilder.php                        
 ------ ----------------------------------------------------- 
  38     Call to an undefined method                          
         Drupal\Core\Entity\EntityInterface::getBaseClass().  
  39     Call to an undefined method                          
         Drupal\Core\Entity\EntityInterface::getStatus().     
 ------ ----------------------------------------------------- 

 ------ ---------------------------------------------------------- 
  Line   src/Entity/Breakpoint.php                                 
 ------ ---------------------------------------------------------- 
  111    Call to an undefined method                               
         Drupal\Core\Entity\EntityInterface::getBreakpointsIds().  
  114    Call to an undefined method                               
         Drupal\Core\Entity\EntityInterface::getStructureId().     
 ------ ---------------------------------------------------------- 

 ------ -------------------------------------------------- 
  Line   src/Entity/Layout.php                             
 ------ -------------------------------------------------- 
  91     Call to an undefined method                       
         Drupal\Core\Entity\EntityInterface::getWeight().  
  92     Call to an undefined method                       
         Drupal\Core\Entity\EntityInterface::getWeight().  
 ------ -------------------------------------------------- 

 ------ -------------------------------------------------------------------- 
  Line   src/Form/BreakpointForm.php                                         
 ------ -------------------------------------------------------------------- 
  105    Method Drupal\bootstrap_layout_builder\Form\BreakpointForm::save()  
         should return int but return statement is missing.                  
 ------ -------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Form/LayoutForm.php                                                
 ------ ----------------------------------------------------------------------- 
  113    Method Drupal\bootstrap_layout_builder\Form\LayoutForm::save() should  
         return int but return statement is missing.                            
 ------ ----------------------------------------------------------------------- 

 ------ ---------------------------------------------------- 
  Line   src/Form/LayoutOptionDeleteForm.php                 
 ------ ---------------------------------------------------- 
  28     Call to an undefined method                         
         Drupal\Core\Entity\EntityInterface::getLayoutId().  
 ------ ---------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   src/Form/LayoutOptionForm.php                                         
 ------ ---------------------------------------------------------------------- 
  25     PHPDoc tag @var has invalid value                                     
         (\\Drupal\Core\Routing\CurrentRouteMatch): Unexpected token           
         "\\\\Drupal\\Core\\Routing\\CurrentRouteMatch", expected type at      
         offset 52                                                             
  82     Variable $layout in PHPDoc tag @var does not match assigned variable  
         $option.                                                              
  189    Method Drupal\bootstrap_layout_builder\Form\LayoutOptionForm::save()  
         should return int but return statement is missing.                    
 ------ ---------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Form/LayoutOptionsForm.php                                         
 ------ ----------------------------------------------------------------------- 
  22     Property                                                               
         Drupal\bootstrap_layout_builder\Form\LayoutOptionsForm::$entity has    
         unknown class Drupal\bootstrap_layout_builder\Layout as its type.      
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols    
  37     Call to method id() on an unknown class                                
         Drupal\bootstrap_layout_builder\Layout.                                
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols    
  48     Call to method getLayoutOptions() on an unknown class                  
         Drupal\bootstrap_layout_builder\Layout.                                
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols    
  107    Call to method getLayoutOptions() on an unknown class                  
         Drupal\bootstrap_layout_builder\Layout.                                
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols    
  112    Method Drupal\bootstrap_layout_builder\Form\LayoutOptionsForm::save()  
         should return int but return statement is missing.                     
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------- 
  Line   src/LayoutListBuilder.php                                  
 ------ ----------------------------------------------------------- 
  44     Call to an undefined method                                
         Drupal\Core\Entity\EntityInterface::getNumberOfColumns().  
 ------ ----------------------------------------------------------- 

 ------ ----------------------------------------------------------- 
  Line   src/Plugin/Deriver/BootstrapLayoutDeriver.php              
 ------ ----------------------------------------------------------- 
  59     Call to an undefined method                                
         Drupal\Core\Entity\EntityInterface::getNumberOfColumns().  
  61     Call to an undefined method                                
         Drupal\Core\Entity\EntityInterface::getNumberOfColumns().  
 ------ ----------------------------------------------------------- 

 ------ -------------------------------------------------------------------- 
  Line   src/Plugin/Layout/BootstrapLayout.php                               
 ------ -------------------------------------------------------------------- 
  315    Call to deprecated function drupal_get_path():                      
         in drupal:9.3.0 and is removed from drupal:10.0.0. Use              
           \Drupal\Core\Extension\ExtensionPathResolver::getPath() instead.  
  376    Call to an undefined method                                         
         Drupal\Core\Entity\EntityInterface::getLayoutOptions().             
  501    Call to an undefined method                                         
         Drupal\Core\Entity\EntityInterface::getClassByPosition().           
 ------ -------------------------------------------------------------------- 

 [ERROR] Found 24 errors  

Proposed resolution

  • Change from ^8 || ^9 to core_version_requirement: ^8 || ^9 || ^10 in the bootstrap_layout_builder.info.yml
  • Change from ^8.7.7 || ^9 to ^8 || ^9 || ^10 in the composer.json
  • Change all deprecated packages, classes, functions, asset libraries to the Drupal 10 way

Remaining tasks

  • ➖ Change to ^8 || ^9 || ^10
  • ➖ This will ease the work on further drupal-check issues
  • ➖ Real physical testing with Drupal ~10

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
📌 Task
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

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.

No activities found.

Production build 0.71.5 2024