Drupal8: Content Import from a CSV file into any content type

Hi all,

Today i am going to share a module which help us to import content the easily into the application using a simple CSV file.

Actually, this module was created by friend Dhayanandan and all the credits goes to him only.

He has given complete step by step procedure to import the content into the application.

URL: https://www.drupal.org/project/contentimport

This module has reduce complete manual work in creating content in the admin page. Within a few seconds, you can import more number of contents.

And this module has got more popularity and enhancement request from various people.

So, those who required to import content easily, can give a try and provide your valuable feedback.



Drupal8: Add class to body tag

Here is the solution for adding our custom class to body tag using preprocess_html() function.

function hook_preprocess_html(&$variables) {
$variables[‘attributes’][‘class’][] = ‘class-name’;

If you want to add class for all node of specify content type, you can do like below

function hook_preprocess_html(&$variables) {
if ($node = \Drupal::request()->attributes->get(‘node’)) {
if($node->getType() == ‘content_type_name’) {
$variables[‘attributes’][‘class’][] = ‘class-name’;

Hope this will helpful to you…


Drupal 8

Drupal is a free, open-source CMS (Content Management System) application built on PHP. It is a powerful solution for creating various online projects starting from personal blogs, through corporate platforms all the way up to political and governmental websites.

The script was first written and released by Dries Buytaert in 2001 and it was focused on massaging. Since 2014 the application is developed and maintained by a community of users, which assures the reliability it is proud of.

The latest major release of the platform – Drupal 8 was announced in 2015 and includes brand new features and improvements such as the WYSIWYG (What You See Is What You Get) editing interface and the new intuitive object-oriented backend.

Since 2017 the application is used by more than 1.2 million websites including well-known organizations, governmental and university platforms and many others.

Despite of the fact that there are lots of CMS scripts available on the market Drupal has a leadership position, compared to the others. At the chart below you can see the market share that Drupal takes.

Going forward i am going to share issues and tips faced in my Drupal 8 projects. Hope it might be helpful to someone who might have face same type of issue in their project.


Too many connections mysql

Some days before, after reached my office, i tried to access my web application, its show me a error message “Too many connections“, so I immediately logged in mysql server and checked the mysql service, it shows me “Running…” and then i connect mysql using

“mysql -u root -p”

its connected successfully. And then i checked current processlist using the below command,

“Show processlist”

its shows me around 370 queries waiting in the queue which is more than max_connections. I had bad memory to remember everything, i just forget what maximum connection i set to this variable. To find this i edit the my.cnf file and it was 360. Actually this max_connections is a system variable and its default value is 151 which provides better performance. For my application, 151 is not enough, so we set to 360. But on that day we didn’t except this will go more than 360 and mysqld always support max_connection+1(super user). So that when the situation like this comes, we can easily solve the issue or kill the process which are waiting in the queue using the super user account.

When i try to find the number of users logged-in in the site using query, the last connection which i have used(super user account) get hanged and then i couldn’t able to connect mysql. SO now there is no other way for me to connect mysql. i need to wait for the queue to process. I waited for some 30 to 45 minutes but the queue is not processing…so finally i restarted the mysql service and all the queries in the queue get killed and then i able to logged into my application.

The bad thing is we couldn’t able to trace out the issue why this happened? There is no traffic to site and all the servers are very cool. This is one more very good challenge for me after i come back to office from weekend. I succeeded without knowing the root cause of the issue. But after many hours, we found its because of we took DB Dump in the morning without putting the site offline. Mysqldump will lock all the tables while running and queries that request to the server put in the queue and thats the reason why we got this too many connections.

So whenever you taking mysqldump, please put your site down and then take mysqldump. This will avoid these type of issues in feature. This is very good learning for me.

How to register for Tamilnadu electricity board online services

It is very to easy to register your EB Account in online. Please follow the below steps to register it…

If you don’t have account previously, then follow the below steps,

  1. Go to https://www.tnebnet.org/awp/userRegister?execution=e1s1
  2. Clicking the Select button to find your Region
  3. Find your Region and click on select button.
  4. Now Enter your consumer number, you can get this number in your EB card at right side top(Ex: xxx-xxx-xxx). Here enter these number without hyphen(-)
  5. Click the Check Details button
  6. Once the details came, it will ask you confirmation and click the confirm button to proceed further.
  7. Now fill your details and click the Register button and it will send you the confirmation email to your registered email ID.
  8. Go to registered email id and click the confirmation link,
  9. Now login into site with registered account and password.
  10. You will find the EB Account that you registered.

You can also register more than one EB account, by clicking the Add Account



« Older entries