Using attributes in templates

In Drupal 8 twig template use {{ attribute }} variable heavily. You should know about {{ attribut }} variable to add/change/edit that variable.

Adding a CDN asset to drupal theme

Add CDN/External css

  <?php /* Comment goes here */
 function beginning_preprocess_html(&$variables) {  drupal_add_css('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', array('type' => 'external'));

Get node type in template file

<?php /* new code block */

   if (arg(0) == 'node' && is_numeric(arg(1))) {
   $node = node_load(arg(1));
   if ($node && $node->type == 'machin_name_of_node_type') {
   print '<h2 class="title comment-form review-form">Add new review</h2>';
   else {print '<h2 class="title comment-form">Add new Comment</h2>';}
  /* End of new code block */

Theme system overview

Drupal's theme system allows a theme to have nearly complete control over the appearance of the site, which includes both the markup and the CSS used to style the markup.

Subscribe to Template

Sample blackbox block

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas non porta odio, id mattis erat.

Nam sed tincidunt eros. Donec a venenatis odio, vitae commodo sem. Vivamus ullamcorper pellentesque erat, in adipiscing tortor scelerisque sit amet. Nulla pulvinar urna magna. Vivamus a ipsum lorem. Etiam adipiscing pulvinar lorem.