Showing posts from December, 2021

Remove drupal 9 extensions from database

  drush eval "\$module_data = \Drupal::config('core.extension')->get('module'); unset(\$module_data['MODULE_NAME']); \Drupal::configFactory()->getEditable('core.extension')->set('module', \$module_data)->save();" If you get any more warning like below:  Then run this commands too: drush php - eval "\Drupal::keyValue('system.schema')->delete('my_already_removed_module');" drush php - eval "\Drupal::keyValue('system.schema')->delete('update_test_0');" Source: Contribution from:

Create local drupal 9 environment via Lando

 Lando is opensource image runner to build and use virtual hosting in local machines.  Requirements:  Lando Docker Lando: Install lando as per the docs here . Docker: Please follow the lando docs, docker should be installed automatically. There may be some dependency on Microsoft Dot net Framework 3.5 . install it manually  First create a directory in your Computer:  Example Directory: E:\Web\eduvai Create the lando yml file:     filename: .lando.yml      file contents: Open command line interface and type lando rebuild. Import existing DB:  lando db-import eduvai.sql.gz --host drupal_db Examples from development. 

PHP redirect from http to https and www to non-www in Drupal 9

settings.php  Go to sites/default/settings.php add the following lines in the top of the file below <?php  if ( (! array_key_exists ( 'HTTPS' , $_SERVER )) && (PHP_SAPI !== 'cli' ) ) {   header ( 'HTTP/1.1 301 Moved Permanently' );   header ( 'Location:' . $_SERVER [ 'REQUEST_URI' ]);   exit (); } // Remove www if ( $_SERVER [ 'HTTP_HOST' ] == '' ) {   header ( 'HTTP/1.0 301 Moved Permanently' );   header ( 'Location:' . $_SERVER [ 'REQUEST_URI' ]);   exit (); }

Enable Theme Debug in Drupal 9

services.yml Navigate to  \sites\default create a the file sites/default/services.yml from sites/default/ set the parameters as follows: parameters: twig.config: debug: true auto_reload: true cache: false settings.local.php  Navigate to / sites/ Make a copy of   example.settings.local.php   and rename it to   settings.local.php Locate the following lines and uncomment # $settings['cache']['bins']['render'] = 'cache.backend.null'; # $settings['cache']['bins']['page'] = 'cache.backend.null'; # $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null'; settings.php Navigate to  sites\default Open  settings.php  and search for ' local.php ' You should then find the following code block if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { include $app_root . '/' . $site_path . '/settings.local.php'; }