Categories

(83)
(69)
(8)
(34)
(74)
(149)

Flexible materials sorting with the help of Radioactivity module

03.04.2014
Flexible materials sorting with the help of Radioactivity module
Author:

While planning site architecture with a large amount of materials, web developers often face such issue: how to implement a flexible materials sorting, or how to make the most interesting articles not to be lost among the new content?

Here, our Drupal web agency will describe the solution we have implemented while handling this kind of task.

Let’s suppose that we have a blog with interesting and informative articles. Users read them, leave comments and vote (let voting functionality be implemented by Fivestar module). There is a need to show the blog posts in such a manner that a new content is in the top but at the same time the most popular materials should not be lost at the bottom. For this case, Radioactivity module is a perfect solution. It has an abstract value called "Energy", with the help of which the order of the materials is determined. Basically, the module allows you to configure the increase and decrease of energy when materials have either been viewed or not. And thanks to the built-in integration with Rules module, it is possible to expand the rules of the energy impact.

So after its installation, the module can be configured at admin/structure/radioactivity:

radioactivity module settings

When adding a field type ‘Radioactivity’ to any content, we can choose the profile settings for it. It is obvious that the rules of the energy’s increase and decrease will be different for users and content. That is why we have an opportunity to use a unique profile for each field.

Let's take a look at how we can create a new profile with our own settings. First step is to push +Add button.

new radioactivity module profile creation

We see a page where we can configure profile name; specify how long it takes for the energy to be decreased by half if the material is not changed; how often the energy will be changed for the event; indicate energy level at which a half-life won’t work anymore; type of profile.

There are three types of profile:

  • Simple - the module will just add or subtract an amount of energy, that is it will work as a numerator;
  • Basic - this type allows you to set period for half-life. The choice is limited to six hours, a day, two days, weeks and a month;
  • Advanced - the period for half-life can be configured with the accuracy up to a few seconds. Here you can also set up the energy level at which half-life won’t work.

However, these setting are not enough. For full functionality, we should perform several other actions:

  1. To create a field for the content type, to choose the settings profile and set the energy level which should be added to the new material.
  2. To create new view for the material or modify an existing one, by adding energy field to the sorting criteria, to add several other fields (NID, title, radioactive energy) and to set up the sorting according to the decrease of the energy levels.

A particular attention should be paid to the settings of the output parameter of Energy field in Views. The module offers several options of its definition. The most popular among them are numeric and percentage values.

With these simple settings now energy increases whenever material is viewed and the energy decreases by half during the defined period.

Rules settings have the ability to increase or decrease the energy depending on our needs. For example, along with Fivestar module, you can create a rule that will increase the energy by a formula:

Energy = Energy' * the number of Fivestar stars.

Where Energy' - is that is the previous rate of energy.

And this is only one of many possibilities offered by the Radioactivity module.

For more information read the documentation, visit Radioactivity module page, or view a tutorial video.

Please find an archive where you can see the example of module’s work, below. By the way, for this purpose you can also download and deploy a popular distribution Drupal Commons, which also takes advantage of this module.

7 votes, Rating: 3

Read also

1

Previously we presented top of SEO modules recommended for website SEO optimization. Now learn about additional but certainly...

2

We use "Git Flow" repository operations model quite often in our work. Let’s consider the scheme in detail.

3

Changes in Drupal 8 have also affected the process of creating your own widgets and formatters. The new Plugin API significantly simplifies this procedure.

4

One can easily be lost in the variety of Drupal themes. Find out information about the best and the most significant of them.

5

Continuing review of Panels module functionality, this blog deals with unique context creation with help of Chaos tool suite.

Subscribe to our blog updates