I make extensive use of the Webform module and often use Views for managing the webform submissions.

I'm fairly new to the Actions/Rules/Triggers backend of Views Bulk Operations (VBO), but I'd really like to be able to use it in my submission management views.

I've written a module that accepts submission IDs from the URL like so: mymodule/form/314/submissions/201+202+203 and generates a page with information from all the listed submissions (in this case, submissions 201, 202, and 203).

I want to use the VBO "Pass ids as arguments to a page" operation to select submissions in a my Views table, and pass their IDs to my custom page.

As far as I can tell, this isn't possible since webform submissions are not entities. So what I'm wondering is, how can I define a very simple entity type for webform submissions, so that I can use VBO on them?

I assume I should implement hook_entity_info(). I think the entity really only needs to include the submission ID in my case (the sid column in the webform_submissions db table).

I've read through the docs on defining custom entities, but can't figure out how to apply that stuff where I'm not actually wanting to create an entity type from scratch. Thanks!

  • Sorry, I'm not able to help you. I just wanted to say that what I see here is an abuse of webform module. IMHO you should have done everything with nodes. You would have had entities, views, VBO, and everything.
    – ermannob
    Jan 21, 2013 at 18:47
  • I'm not sure what you mean. I would have had entities, views, VBO--everything except everything that Webform offers: FAPI forms, conditionals, and validation through the UI, automatic submission receipts (emails), submission database storage, submission exports, etc. I don't even know how you'd go about doing what you're suggesting. Maybe others in the community can set this straight?
    – joe_flash
    Jan 21, 2013 at 18:54
  • I'm not sure about FAPI forms but, for conditionals you have conditional_fields module. For validations you have the normal fields/entity editor or field_validation module. The submission receipt can be overloaded with a hook (or maybe there's a module for that). Submission database storage and basic reporting: nodes and views are exactly the strongest tools to store and retrieve content in drupal. It's just my opinion.
    – ermannob
    Jan 21, 2013 at 19:07
  • @ermannob, I appreciate your response, but I don't think I understand you fully. Are you saying I should have created a content type for every webform (there are 50+) and allowed users to create new nodes of that content type for every submission? I fail to see how setting up all the modules you mentioned (the functionality for which Webform handles more-or-less out of the box), in addition to managing 50+ content types, and form-specific user permissions is a good way to go for the sole purpose of getting a VBO checkbox in a Views report.
    – joe_flash
    Jan 21, 2013 at 19:19
  • I understand it's too late now... You did a really impressive job with webforms! When you will build a new website, try to consider the "node way"! :)
    – ermannob
    Jan 21, 2013 at 19:26

2 Answers 2


Got it working. In a custom module (mymodule), I implemented hook_entity_info() like so:

function mymodule_entity_info() {
  $info = array();
  $info['mm_submission'] = array(
    'label' => t('Simple Webform Submission Entity'),
    'base table' => 'webform_submissions',
    'fieldable' => FALSE,
    'entity keys' => array(
      'id' => 'sid',
      'label' => 'sid',
  return $info;

This very simple entity definition was sufficient for VBO to treat my submissions as entities and pass their IDs to my custom URL.

Though I didn't need to, it should be possible to override the entity class controller and its entity functions (load, save, delete, etc) should you need to. This tutorial by Ronald Ashri was useful to me and talks more about that.

After installing my custom module, I was pleasantly surprised to see a "Bulk operations: Webform submissions" field magically appear in the list of available Views fields.

I didn't make any other connection between Webform submissions and my custom entity type, nor otherwise tell VBO to treat the Views results as mm_submission entities--somebody (Views/VBO/Webform?) just automatically made it happen; which is awesome.

I presume VBO knew to process the submissions as mm_submission entities because of the entity type base table attribute? Not sure without looking more closely; perhaps someone else can shed more light on that.


There is a module available called Webform Entity that does just that although it goes further and makes the submissions fieldable. From that project page:

This module exposes webform submissions as a fieldable entity on behalf of webform and optionally provides a bundle for each of the content types for which webform functionality is enabled. This allows you to configure fields on a base form that are appended to the fields for the webform for that individual node and these fields can be exposed to views.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.