Remove query condition in Drupal 8

 * Implements hook_query_QUERY_ID_alter().
function mymodule_query_taxonomy_term_access_alter($query) {
  /** @var \Drupal\Core\Database\Query\Select $query */
  $conditions = &$query->conditions();
  foreach ($conditions as $i => $condition) {
    if (isset($condition['field']) && $condition['field'] === 't.default_langcode') {

Disable cache for a specific page

Disable cache for a custom page from route declaration.

If you want to disable cache for a custom controller (Custom module), You have no_cache option (YOUR_MODULE.routing.yml).
Example :
File : mymodule.routing.yml

Drupal 8 System Link Menu

  title: Administration
  route_name: system.admin
  weight: 9
  menu_name: admin

Drupal 8 remove css,js query strings

Drupal 8 remove css,js query strings

Update your THEMENAME.theme


Render a Render array to HTML code

Render a Render array to HTML code

How to get HTML from drupal 8 renderer array ?

How to convert Render array into HTML output code ?

Vuejs - Hide vuejs syntax when page loading

Vuejs - Hide vuejs syntax when page loading
[v-cloak] {
  display: none;

<div v-cloak>
  {{ message }}





Drupal 8 local settings for development

Drupal 8 Check is front page with alias

Drupal 8 Check is front page with alias
$current_path = \Drupal::service('path.current')->getPath();
$front_uri = Drupal::config('')->get('page.front');
$front_alias = \Drupal::service('path.alias_manager')->getAliasByPath($front_uri);
$current_alias = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);
$isFrontPage = \Drupal::service('path.matcher')->isFrontPage() || $front_alias === $current_alias;

Drupal 8 Twig concat string

Drupal 8 Twig concat string

Path Finder sort order

Path Finder sort order

Help you control your Path Finder sort files/folder order.

Fix Node.js doesn't look global folder on MAC

Fix Node.js doesn't look global folder on MAC

Open your ~/.bash_profile add this line

export NODE_PATH=/usr/local/lib/node_modules

Save ~/.bash_profile

Drupal 8 get absolute url

    $current_url = \Drupal\Core\Url::fromRoute('<current>', array(), array("absolute" => TRUE))->toString();

MongoDB Admin software

Looking for a best MongoDB Admin for cross-platform. Try it right now:


Download multi files with wget


and your command line

wget -E -H -k -K -p -e robots=off -P /Downloads/ -i ./list.txt

Disable All Cache on Drupal 8

Open settings.php add these lines:

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/';
$settings['cache']['bins']['render'] = 'cache.backend.null';

Use drush with command drush cr to clear all cache


Using XamarinForms with PixateFreestyle

Demo app show how to using Xamarin Forms with PixateFreestyle

Full source code here:

Exit iOS and Android mobile app with Xamarin

Call this function to close the app:


Get direct download links of Xamarin

Installing Drush on Mac using Homebrew

  1. Install Homebrew with command:
    ruby -e "$(curl -fsSL"
  2. Use Homebrew install drush with commands
    brew tap homebrew/dupes
    brew tap homebrew/versions
    brew tap homebrew/php
    brew install php55
    brew install composer
    brew install drush

Drupal 7 with Laravel 5

I just write a Drupal module allow integrate Drupal with Laravel to work together, you can check here:

More information and example will post in next article.

Code fun.

Install Multiple PHP Versions and PHP 5.5 with Virtualmin on CentOS


Beginning in Virtualmin 3.99, Virtualmin allow you install multiple version of PHP with Software Collections.

MAC OS: Change fn to command key

Just moving to MAC OS and have problem with fn key when using Windows keyboard, fortunately there is a free application called Karabiner help you can swap fn and command key.

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


.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;

Quick Fix FlexSlider with Firefox 29 on Windows

FlexSlider error with Firefox v29 on Windows, it doesn't apply animation for slider item. Here is sollution to fix them:

  $(document).ready(function() {
      touch: !$.browser.mozilla

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.

Installing VirtualMin on CentOS


VirtualMin is free system help user can easy manager their server or VPS. I usually use it with Drupal hosting, here is note for install VirtualMin on CentOS

Update System

# sudo yum -y update

Install pre-requisites

# sudo yum -y install perl

Download VirtualMin Installer

 # wget


# sudo sh

Wait a moment, it about to 5 minutes to install VirtualMin on your system.