Translate a JS string from Drupal interface translations

Translate a JS string from Drupal interface translations


Drupal.t("My String");

Clear the Drupal Cache.

This string appear in /admin/config/regional/translate

if not then check your libraries.yml file 
And add the corresponding dependencies THEME.libraries.yml:
  - core/jquery
  - core/drupal

Enjoy :)

Bartik Admin - Super Admin theme as a Batrik theme

Bartik Admin - Always Super Admin theme as a Batrik theme.

We don't want to mess up with other topics during the growth. It's just a development-friendly developer. We must always set the superadmin as a bartik. If you want, the configuration settings can be overridden. Only the superadmin user (Superadmin UID=' 1') will be accessible.

Super administration theme will be override the admin pages as batrik. Drupal allows you to define a different theme for administration pages.


Admin pages are in English Drupal?

All Admin pages are in English and admin menu always in LTR?

1) First go to Administration -> Configuration -> Regional and language -> Languages -> Detection and selection tab and make sure to have “Account administration pages“ enabled.

2) Then go to People and edit your user. Admin -> Edit Profile -> Edit

Go down to the Language settings section. You should now see a Administration pages language dropdown. 

Select and save.

3) Go to the administration language using the following settings:

url: /admin/config/regional/language/detection

"Account administration pages" - Enabled

"Follow the user's language preference." - Enable

and drag and drop to the top position.

Drupal Multisite Setup on a XAMPP with Localhost

Install a XAMPP on your local machine.  Followed recommendations to not install in program files as there is some firewall problems. (e.g., c:\xampp)

Install a Drupal 8 instance that will act as the root site for our multisite instance. In our example, the root site will be called drupal8multisite, will be reachable at, and will be installed at /xampp/htdocs/drupal8multisite

100+ Drupal Questions and Answers

I hope this helps you get Drupal Questions and Answers. If you have any queries/modifications/best answers or if something went wrong kindly post your content in the comment section. So, it will helpful to others.Thanks.

“Doing nothing for others is the undoing of ourselves.” 
― Horace Mann

“You need an attitude of service. You're not just serving yourself. You help others to grow up and you grow with them.” 
― David Green

Create a Blog website using SimpleBlog Drupal8 Theme.


SimpleBlog is a fresh, clean, web-based grid-responsive theme of Drupal 8. For drupal 8, this theme can be used to build your strong grid-layout Blogging website.

Drupal8 Theme

Simple Blog is a light-weight template, with 3 columns. It is a basic theme for starting a blog with grid system.

SimpleBlog Features:

  • Responsive Blog
  • Simple clean design
  • Grid Layout (Masonry grid layout library)
  • With/without Grid Layout Configuration
  • Supports 3-columns layout

Where are Drupal8 contact forms entries stored?

Contact form

Contact Storage module will provide storage for Contact messages which are fully-fledged entities in Drupal 8.

This plus core contact module aim to provide functionality equivalent to the base-features of Webform or Entity Form.

Contact Storage

Contact Storage module provides storage for all the messages submitted through the forms on your site as well as views integration to manage them.

URL redirect rewrite using the .htaccess file

Create a 301 redirect for all http requests that are going to the old domain to new domain

If you are wanting to only redirect a specific subdomain, you would do something like this:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^$ [OR]
  RewriteCond %{HTTP_HOST} ^$
  RewriteRule (.*)$$1 [R=301,L]

Redirect  301 /olddomainname

Integrate Instagram Without API + Drupal 8


It's a very simple module that integrates without an API with Instagram and generates a block that contains your latest Instagram messages.

To submit bug reports and feature suggestions, or to track changes:

Install as you would normally install a contributed Drupal module. See:
for further information.

To add Instagram Block to specific content region Go to Block Layout.
i.e Home-> Administration-> Structure-> Block layout.

You must also add the Instagram account user name as part of the block setup to pull posts.

Drupal Theme Hook Suggestions

Theme hook enables any module or theme to provide suggestions for alternative theme feature or template name suggestions and reorder or remove suggestions.

Drupal 7:

* Implements hook_preprocess_HOOK() for node templates.
function MYTHEME_preprocess_node(&$variables) {
  $variables['theme_hook_suggestions'][] = 'node__' . 'first';
  $variables['theme_hook_suggestions'][] = 'node__' . 'second';

Drupal 8:

* Implements hook_theme_suggestions_HOOK_alter() for node templates.
function MYTHEME_theme_suggestions_node_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'node__' . 'first';
  $suggestions[] = 'node__' . 'second';


What are the timer functions to measure the kernel function time

Kernal Function Timefunction "do_gettimefoday" is used to get the time value in kernel.

struct timeval time;

unsigned long local_time;

do_gettimeofday(&time); local_time = (u32)(time.tv_sec - (sys_tz.tz_minuteswest * 60)); rtc_time_to_tm(local_time, &tm);

printk(" @ (%04d-%02d-%02d %02d:%02d:%02d)\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);