0

Here is an action I need to use with VBO:

/*
 * Implements hook_action_info()
 */
function ams_action_info() {
  $action = array(
    'ams_archive_action' => array(
      'type' => 'ams_survey',
      'label' => t('Archive survey'),
      'configurable' => FALSE,
      'triggers' => array('any'),
//      'behavior' => array('changes_property')
    )
  );
  return $action;
}



/*
 * Implements a registered drupal action to set the archive bit on given survey
 */
function ams_archive_action(&$entity, $context = array()) {

  drupal_set_message(print_r($entity, TRUE));
  $entity->archive = 1;
  entity_save('ams_survey', $entity);
}

I selected the action in the list for a Bulk Operations field in a table view for my custom entities 'ams_survey'. The view and operations form look fine but executing the action just reloads the page. If I execute in the preview in view builder admin, I get an error popup starting with "An AJAX HTTP error occurred." but the action is successfully performed.

A block display for this view is being loaded and displayed inside a form callback which is being loaded in a page callback from hook_menu(). I have tried turning off AJAX and turning off views cache with the same result.

0

The malfunction was due to the VBO form appearing inside another form. I changed the page callback to be a regular function (not form builder) that loads the block view and actions are working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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