Drupal

Drupal disable https verify when working with insecure ssl website

Open settings.php add this line:

 

$settings['http_client_config'] = ['verify' => FALSE];
 

Safe url data transfer from Javascript to Drupal

  Drupal.safe_encode = function(element) {
    var encode = encodeURIComponent(JSON.stringify(element));
    var base64 = Base64.encode(encode);
    base64 = base64.replace('/', '_');
    base64 = base64.replace('+', '-');
    return base64;
  };
  var base64 = Drupal.safe_encode(object);
  var url = Drupal.url('module-url?component_data='+ base64);

 

LIVE RELOAD WITH DRUPAL

Drupal 7 with Laravel 5

I just write a Drupal module allow integrate Drupal with Laravel to work together, you can check here: https://www.drupal.org/project/illuminate

More information and example will post in next article.

Code fun.

Drupal Charts module and custom Highcharts properties

Drupal Charts is a great charts module for Drupal, it allow use you both Google Charts and Highcharts. You can use same setup for both Google Charts and Highchats but some settings properties not implement yet. Here is tips allow you add custom chart properties

Bootstrap theme menu hover and clickable parent menu

This article show you how config Drupal Bootstrap theme allow show dropdown menu when hover and clickable parent menu

First add this css to your theme css, usually is style.css

@media (min-width: 768px) {
  .dropdown:hover .dropdown-menu {
    display: block;
  }
}

Second, override theme_menu_link to remove data-toggle

Fix Drupal .htaccess symlinks problem

Some hosting problem with Drupal .htaccess symlinks, default Drupal use "Options +FollowSymLinks", you need change it to "Options +SymLinksIfOwnerMatch" to resolve the issue.

Change .htaccess at root of Drupal folder, files folder and temporary folder to fix them.

Simple CSS to optimize Drupal tabs operations with Bootstrap

 

<style>
.page-node .tabs--primary {
  position: fixed;
  left: 0;
  top: 35%;
}
@media (max-width: 767px) {
  .page-node .tabs--primary {
    display: none;
  }
}
.page-node .tabs--primary.nav-tabs > li {
  float: none;
}
.page-node .tabs--primary.nav-tabs > li a {
  border: 1px solid #DDDDDD;
  border-radius: 0;
}
.front .page-header {
  display: none;
}
</style>

Translate Drupal from English to Vietnamese with POEdit

Drupal multi language

Drupal support multi language website and user can translate with Locale module. But it have some difficult when you translate a lot text or you need send to customer and they will translated by himself. Export current language to .po file and translate with POEdit is an easy way.

Update Drupal core with Drush

Update Drupal core with Drush

Tips update Drupal core with Drush:

  1. Make sure you enabled "Update manager" module otherwise enable it with Drush by command: drush en update
  2. Always backup your site and database before update Drupal core.
  3. Run Drush command to update Drupal core: drush up drupal

Fix Drush fail download dev module on Windows

In drush/commands/pm/package_handler/wget,inc

// Add to URL so it is part of the cache key . Dev snapshots can then be cached forever. 
if (strpos($release['download_link'], '-dev') !== FALSE) { 
   $release['download_link'] .= '?date=' . $release['date']; 
} 
$filename = basename($release['download_link']);

should probably be replaced with this: