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 :)

Drupal Bartik Admin - Drupal Super Admin theme as a Batrik theme

Drupal Bartik Admin-Super admin theme forever.

It's just an emerging product. As a bartik, we have to always configure the superadmin. The software settings may be overridden if you need to. It will only be open to the superadmin useruid 1.

The admin pages will be overridden by super admin theme as batrik. Drupal lets you identify a specific Admin Pages theme.


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 Drupal 8's new, clean grid-responsive theme, focused on the site.

Drupal8 Theme

Easy Blog is a light weight, 3 column design. It is a simple drupal theme for starting a grid-system blog.

SimpleBlog Features:

  • Responsive Feature
  • Simple design
  • EasybGrid Layout
  • With/without Grid Layout 
  • Supports 3 layout

How can I change page title in Drupal 8?

There are a couple of solutions to change the page title

 * Implements THEME_preprocess_page_title()
function THEMENAME_preprocess_page_title(&$variables) {
  $current_url = \Drupal\Core\Url::fromRoute('<current>');
  $url = $current_url->getInternalPath();
  if($url == 'home') {  
    $variables['title'] = 'Welcome to Development Portal | ThirstySix';

 * Implements THEME_preprocess_page(). 
function THEMENAME_preprocess_page(&$variables) {
  $node = \Drupal::routeMatch()->getParameter('node');
  if ($node) {
    $variables['title'] = $node->getTitle();


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 is a very simple module that interacts with Instagram without an API and creates a block containing your latest messages from Instagram.

To send bug reports and design feedback or to track changes: https:/ without api Go to Block Design to attach Instagram Block to specific content region.
I.e Home-> Admin-> Structure-> Block.

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