15 Sep 2024

feedDrupal.org aggregator

#! code: Drupal 11: Using The Finished State In Batch Processing

This is the third article in a series of articles about the Batch API in Drupal. The Batch API is a system in Drupal that allows data to be processed in small chunks in order to prevent timeout errors or memory problems.

So far in this series we have looked at creating a batch process using a form and then creating a batch class so that batches can be run through Drush. Both of these examples used the Batch API to run a set number of items through a set number of process function callbacks. When setting up the batch run we created a list of items that we wanted to process and then split this list up into chunks, each chunk being sent to a batch process callback.

There is another way to set up the Batch API that will run the same number of operations without defining how many times we want to run them first. This is possible by using the "finished" setting in the batch context.

Let's create a batch process that we can run and control using the finished setting.

Setting Up

First we need to create a batch process that will accept the array we want to process. This is the same array as we have processed in the last two articles, but in this case we are passing the entire array to a single callback via the addOperation() method of the BatchBuilder class.

Read more

15 Sep 2024 6:51pm GMT

13 Sep 2024

feedDrupal.org aggregator

The Drop Times: Sustainability Takes Center Stage at DrupalCon Barcelona 2024

Discover how DrupalCon Barcelona 2024 is prioritizing sustainability with eco-friendly initiatives and practices. From reducing food waste to promoting mental well-being, attendees are encouraged to participate in creating a more environmentally conscious event. Join the movement towards a greener future at DrupalCon Barcelona.

13 Sep 2024 2:21pm GMT

Golems GABB: Gamification on Drupal Websites

Gamification on Drupal Websites

Editor Fri, 09/13/2024 - 13:26

Gamification is the integration of game elements into non-gaming environments like websites to enhance user experiences. Its purpose is to make the user's experience more fun, motivating, and rewarding. Like Grand Theft Auto: San Andreas, where players explore a big landscape full of problems and prizes, gamification adds excitement and advancement to typical digital platforms.
Drupal provides an excellent setting for incorporating gamification elements because it can adapt to changing needs. Like in the game, developers using Drupal can encourage users with rewards such as badges, points systems, and interactive tasks that create a feeling of accomplishment while also promoting involvement within the community.
This article provides a detailed look into combining gamification with Drupal's strong features. Grab a coffee, and let's begin our adventure utilizing Drupal's gamification.

13 Sep 2024 10:26am GMT