Adding parameters to route in Drupal 8

To pass parameters to controller using URI is possible in Drupal 8. It makes URI to contain parameters that can be processed in the controller.Parameters are defined in the routing.yml with curly braces.Following is the example code to pass parameters to route in routing.yml file. hello_world.hello_route: path: ‘hello/{route}’ defaults: _controller: Drupal\hello_world\Controller\HelloController::hello_route _title: ‘This is title Continue Reading

Syntax highlighting using SHJS

SHJS is a JavaScript program which highlights source code passages in HTML documents. Documents using SHJS are highlighted on the client side by the web browser. In the head element of your document, include the sh_main.js script and the script for the programming language you are using. (If you have multiple languages in the same Continue Reading

Syntax highlighting using Rainbow

Rainbow is syntax highlighting library written in Javascript. It is lightweight and primary focused on syntax highlighting for programming languages. It is easy to use and easy customization is possible. It is also easily themable using CSS. To use the rainbow syntax highlighter, download it in your local server and link it to your webpage. Continue Reading

Syntax highlighting using Highlight JS

HighlightJS library offers syntax highlighting for over 170 languages. It can provide many attractive styles . The bare minimum for using highlight.js on a web page is linking to the library along with one of the styles and calling initHighlightingOnLoad: <link href=”styles/arta.css” rel=”stylesheet” type=”text/css” /> <script src=”highlight.pack.js” type=”text/javascript”></script> <script type=”text/javascript”> hljs.initHighlightingOnLoad() </script> To add a Continue Reading

Creating a simple Hello module in Drupal 8

Drupal 8 is has many advanced CMS features with using the most advanced features of PHP language and integrates number of third party libraries.  Drupal 8 makes use of OOP concepts heavily while using PHP classes, objects, namespaces and many design patterns using these.  Symfony is a PHP framework that Drupal borrows from in order Continue Reading