Posts

Print Taxonomy Term Url with list

  {% for item in node . field_category %} <a href = "{{ path( 'entity.taxonomy_term.canonical' , { 'taxonomy_term' : item . entity . tid . value }) }}" > {{ item . entity . name . value }} </a> {% endfor %} Reference: https://www.drupal.org/forum/support/post-installation/2016-04-19/getting-url-of-taxonomy-term-page-from-twig-template

Add jQuery Date picker with month and year selection and a fix starting date

Image
  Today, I have learned how to add a jQuery date picker in Drupal 9 theme. I am going to share the steps and codes here.  Steps:  1. Add jquery library to your drupal 9 theme 2. Create a jquery file for  jQuery date picker 3. Apply custom css code to customized your needs. 4. Attach library to theme file 5. Add the date picker to bootstrap 5 form Dependencies:  jQuery jQuery Date Picker JavaScript Bootstrap 5 Drupal 9 Step 1:  Attach files to the theme's library for Drupal: Open your themes libraries.yml file and put the following code:  datepicker :   version : VERSION   css :       theme :         assets/custom/datepicker/datepicker.css : {}   js :       //code.jquery.com/jquery-3.6.0.js : { type : external }       //code.jquery.com/ui/1.13.1/jquery-ui.js : { type : external }       assets/custom/datepicker/datepicker.js : {} Step 2:  Create a JavaScript file as linked in libraries: ( assets/custom/datepicker/datepicker.js) and put the following jQuery codes: $ ( function () {

Enable Remote Access to mysql

  GRANT SELECT ON koha_ils.* TO libinout@'118.179.175.123' IDENTIFIED BY 'passwd';

Solution of Fields pending deletion in Drupal 9 module uninstallation

Image
  Intro:  Trying to remove a field from database.  after some time, related module is not uninstalling. After searching got reference from https://drupal.stackexchange.com/questions/244275/fields-pending-deletion-stopping-module-unistall-how-to-delete-manually and applied solution worked as   drush php-eval 'field_purge_batch(10000);' You can run cron continuously via following command and try after some time since all the data should be deleted via cron: watch -n 5 drush cron -v Please close this when the warning "Fields pending deletion" is gone.  Thank you to read my blog. 

Remove drupal 9 extensions from database

Image
  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:https://drupal.stackexchange.com/questions/72927/manually-disable-a-module Contribution from: https://eduvai.com

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:  https://github.com/mahsandu/lando-drupal9/blob/main/.lando.yml Open command line interface and type lando rebuild. Import existing DB:  lando db-import eduvai.sql.gz --host drupal_db Examples from eduvai.com 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: https://eduvai.com' . $_SERVER [ 'REQUEST_URI' ]);   exit (); } // Remove www if ( $_SERVER [ 'HTTP_HOST' ] == 'www.eduvai.com' ) {   header ( 'HTTP/1.0 301 Moved Permanently' );   header ( 'Location: https://eduvai.com' . $_SERVER [ 'REQUEST_URI' ]);   exit (); }