Skip to main content

Drupal 8

How to create Queue woker in Drupal 8

How to create Queue woker in Drupal 8

The queue API allows placing items in a queue and processing them later. If you have a task that must be done regularly and it takes more time to complete then Cron queue might be the better solution. 

In Drupal 8, hook_cron_queue_info() has been replaced by QueueWorker Plugin. Define the queue worker by creating QueueWorker folder inside Plugin folder. In the below example, I create a form for sending the email. Emails will be added to the queue on submitting the form. On cron run emails will be dequeued.  

src/Plugin/QueueWorker:

Cache disable

Disable Drupal 8 cache during development

We know Drupal 8 has a heavy caching mechanism, so we need to clear cache for changes made in twig file or some other file to reflect in the site. Basically, a themer or developer won't love the caching system on the development stage. So it is better to disable cache on the development stage rather than clearing cache for every change being made.

And here are the steps to disable cache and save your valuable time:

  • Copy and rename the sites/example.settings.local.php file as sites/default/settings.local.php

Drupal 8

How to manually update Drupal 8 core?

Let's see how to update your Drupal site between 8.x.x minor and patch versions. For example, from 8.1.2 to 8.1.3, or from 8.3.5 to 8.4.0. I hope this will help you.

  • If you are upgrading to Drupal version x.y.z

           x -> is known as the major version number

           y -> is known as the minor version number

           z -> is known as the patch version number.

Format date/time

Formatting the way the date/time is displayed in Drupal 8

You can create a new date/time format by navigating to Admin -> Configuration -> Regional and Language -> Date and Time format and click on 'Add Format'. Once you’ve created date format, you can control the way date is displayed on the node using preprocess function.

In theme_name.theme file, add the following lines. This would override the way date is displayed in node.

Drupal 8 catching

Drupal 8 block caching

The approach to custom block caching is different in Drupal 8 from Drupal 7. In Drupal 8, all renderable arrays are cacheable, even those returned by custom block.

Examples:

  • Some expensive-to-calculate data depends on the active theme: different results for different themes. Then you'd vary by the theme cache context.

Drupal 8

Drupal 8 Accelerate

 
Drupal 8 Accelerate is a grant program designed to eliminate Drupal 8 release blockers. Through the program, a small number of grants have been made that have had a huge impact. The Drupal Association had planned to put $250,000 of community funds towards eliminating the last 50 critical issues between us and release. The Association on it’s part has contributed $62,500 and the Association Board has raised another $62,500 by partnering with 7 outstanding community supporters to “match the match”. The total money raised is close to $222,919.
There are under 15 release blockers standing between us and a Drupal 8 release. It's time to knock out those final issues and get Drupal 8 out into the world. Drupal 8 will set a new standard for ease of use, while offering countless new ways to tailor and deploy your content to the Web. Easily customize data structures, listings, and pages, and take advantage of new capabilities for displaying data on mobile devices, building APIs, and adapting to multilingual needs.

quiz porting

Porting Quiz module for Drupal 8

It would be more than surprising to know if any Drupal developer hasn't had interest to get his hand dirty with Drupal 8 yet! It is quite known that Drupal embraces new notion in every major releases, the same excitement goes with Drupal 8 as well. To name a few better configuration management, RESTful Web Services (based on Symfony), Twig framework for theming, HTML 5, Views in core, and Mobile friendly are some the major features introduced in Drupal 8. To know more about its development cycle and current state, check out https://drupal.org/core/release-cycle

Subscribe to Drupal 8