Skip to Content


Web Omelette: New contrib module: Info Plugins

Planet Drupal - 9 August 2015 - 11:02pm

Today I would like to introduce a new module that I released for the Drupal (developer) community to use and share: Info Plugins. This is for developers who are tired of implementing a bunch of messy _info hooks (and their corresponding callbacks), lumping together functionality that frankly shouldn't even touch. I'm talking about those ugly switch statements in which we have cases for the various extensions we provide. Don't get me wrong Drupal, I love your hook system.

With Info Plugins, much (and progressively more and more) of this becomes cleaner by exposing all those extension points to the cTools plugin system. What I mean by this is that using this module you will be able to declare things like Drupal blocks, filters, field formatters and more, as cTools plugins. This way, all the logic related to one plugin (block, filter or field formatter to continue with the above examples) resides neatly within one single plugin include file.

Let us look at an example a bit more in depth: the Drupal block. Instead of implementing up to 4 hooks (_info, _view, _configure and _save) to manage your blocks, you can now define a new core_block plugin within your cTools plugins folder like so:

$plugin = array( 'title' => t('Example block'), // Your own callback for building the display of the block (called by `hook_block_view()`) // Leaving this empty, the function name would default to `my_module_example_block_view()` 'view' => 'my_module_render_example_block', // Your own callback for building the config form for the block (called by `hook_block_configure()`) // Leaving this empty, the function name would default to `my_module_example_block_configure()` 'configure' => 'my_module_configure_example_block', // Your own callback for saving the config for the block (called by `hook_block_saved()`) // Leaving this empty, the function name would default to `my_module_example_block_save()` 'save' => 'my_module_save_example_block', // ... all other options you may want to pass to `hook_block_info()` ); /** * Returns a renderable array that represents the block content, i.e. * the same as you would return from `hook_block_view()`. * * @param $delta * The block delta */ function my_module_render_example_block($delta) { return array( '#type' => 'markup', '#markup' => 'My custom example block' ); } /** * Returns a form to be used as the block configuration form, i.e. the same * as you would return from `hook_block_configure()` * * @param $delta * The block delta */ function my_module_configure_example_block($delta) { $form = array(); $form['my_custom_field'] = array( '#type' => 'textfield', '#title' => t('My custom block field'), '#default_value' => variable_get($delta, '') ); return $form; } /** * Saves the block configuration, i.e. the same as you would do inside * `hook_block_save()` * * @param $block * An array of values representing the block with it's configuration, i.e. the * `$edit` array passed to `hook_block_save()` */ function my_module_save_example_block($block) { variable_set($block['delta'], $block['my_custom_field']); }

So as you can see, your block definition, render and configuration resides in one file. If you need more blocks, you just define more plugins and you are good to go. There is such a documentation oriented example inside the plugin_examples folder of the module for each available plugin type. Plus, don't forget the file.

Once you install the module, you will have only one administration screen at admin/config/info-plugins where you'll be able to select which plugin types you need. For example, if you need to define a custom block, enable the Core Block plugin type. If you need others, enable them as well. But I recommend you keep them disabled if you don't use them so that their logic doesn't get included in memory (all the relevant hooks and what not). My goal here is to keep a very low foot print.

To see which plugin types are available to use, please consult the project page. And keep checking back because I will add more. And if you want to contribute, please don't hesitate. Take it out for a spin, give it a test and please open issues to let me know of any bugs you find. I will be active on this for a while and want to hammer out all the potential problems before creating a stable release.


In Drupal var switchTo5x = true;stLight.options({"publisher":"dr-8de6c3c4-3462-9715-caaf-ce2c161a50c"});
Categories: Drupal

Ubercart Shipping Insurance

New Drupal Modules - 9 August 2015 - 10:12pm

Adds a new "shipping insurance" checkout pane. Shipping insurance can be either a percentage of the total or a fixed amount.

Categories: Drupal

Commerce Omniva

New Drupal Modules - 9 August 2015 - 11:57am

Omniva field for Commerce. All three Baltic states are available. You can create country based fields, using with shipping module you can configure a complete checkout process.

Categories: Drupal

Tagged SystemQueue

New Drupal Modules - 9 August 2015 - 11:28am

This module extends Drupal Core SytemQueue Queue API backend with the addition of query tags and metadata. This will allow you to perform query alteration on supported queue methods.

This module does not do anything itself and does not have any UI. It is a developer module to use from other contrib modules to implement diverse queue functionalities.

Categories: Drupal

Views Photo Grid

New Drupal Modules - 9 August 2015 - 10:59am
Categories: Drupal

Space Launches

New Drupal Modules - 8 August 2015 - 11:11pm

The Space Launches module provides a way to retrieve, store, and display upcoming space launches.

Categories: Drupal

DrupalCon News: Drupal Business Summit: The Next Generation

Planet Drupal - 8 August 2015 - 9:00pm

What do the businesses in the Drupal community need to do to survive and grow in the next three years?

Drupal 8 will attract a new wave of agencies to compete in the market, and will also enable Drupal businesses to compete at a higher level. A time of big change and competition is coming, and it will no longer be enough just to say you 'do Drupal' and then sit back and watch sales roll in.

Categories: Drupal

Chen Hui Jing: Drupal 101: Starting Drupal development

Planet Drupal - 8 August 2015 - 4:00pm

I recently moved from an agency specialising in building Drupal sites to one which is platform-agnostic, and uses all variety of technologies. As my team was not very familiar with Drupal, I started writing some documentation on setting up locally, installing Drush and commonly used modules, and some other stuff so everyone could get up and running quickly. I’ve modified it to be even more beginner-friendly, for people who’ve never built websites before. This is sort of opinionated so feel free not to follow along exactly.

The basic technology stack

As with most content management systems, Drupal has some system requirements in order to run, commonly known as a technology stack. This simply means you have to install...

Categories: Drupal

Sentiment Analysis

New Drupal Modules - 8 August 2015 - 10:57am

* The module name (Sentiment Analysis) itself describes everything about this module.

* This module provides a field type ("Sensitivity")

* This module needs an additional API key(3rd Party) to check user inputted text
and returns the result of sentiment(If negative).


Categories: Drupal
Syndicate content

about seo