Views Bulk Operations no longer uses hook_node_operations()/hook_user_operations() and instead relies on hook_action_info() to provide it's bulk actions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aidanlis’s picture

Subscribe.

Les Lim’s picture

Status: Active » Needs review
FileSize
1.27 KB

Here's a start.

Valeratal’s picture

subscribe

Les Lim’s picture

Valeratal, you don't need to comment to subscribe anymore. Instead, click the "Follow" button.

Les Lim’s picture

New patch to add an "Update taxonomy term alias" action. Also fixed a variable name mismatch from the previous patch.

jtbayly’s picture

Status: Needs review » Reviewed & tested by the community

I used it, and it worked like a charm on nodes.

makara’s picture

I think it would be cool to also have a trigger when a path alias got created or updated. I.e. hook_trigger_info() and actions_do() etc.

marvil07’s picture

works fine, thanks!

marvil07’s picture

btw here a trivial change without the unneeded spaces

HnLn’s picture

patch from #9 works for me

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/pathauto.moduleundefined
@@ -756,3 +756,52 @@ function pathauto_blog_update_alias(stdClass $account, $op, array $options = arr
+ *
+ * Necessary for Views Bulk Operations integration.

Unnecessary documentation.

+++ b/pathauto.moduleundefined
@@ -756,3 +756,52 @@ function pathauto_blog_update_alias(stdClass $account, $op, array $options = arr
+    'pathauto_node_update_action' => array(
+      'type' => 'node',
+      'label' => t('Update node alias'),
+      'configurable' => FALSE,
+      'triggers' => array('node_insert', 'node_update'),
+    ),
+    'pathauto_user_update_action' => array(
+      'type' => 'user',
+      'label' => t('Update user alias'),
+      'configurable' => FALSE,
+      'triggers' => array('user_insert', 'user_update'),
+    ),
+    'pathauto_taxonomy_term_update_action' => array(
+      'type' => 'taxonomy_term',
+      'label' => t('Update taxonomy term alias'),
+      'configurable' => FALSE,
+      'triggers' => array('taxonomy_term_insert', 'taxonomy_term_update'),

I'm wondering why we should provide the specific 'triggers' for each action when they are already run by pathauto_node_insert|update, etc?

Les Lim’s picture

New patch without the VBO documentation note and the redundant triggers.

Dave Reid’s picture

If we're setting 'message' => TRUE, then how will this work if a user runs a VBO of path updates for 100 nodes at once?

Les Lim’s picture

It's exactly the same callback arguments that are in pathauto_node_operations(). Looking at pathauto_node_update_alias_multiple(), the message is created outside the foreach loop and gives this summary:

  if (!empty($options['message'])) {
    drupal_set_message(format_plural(count($nids), 'Updated URL alias for 1 node.', 'Updated URL aliases for @count nodes.'));
  }

If VBO is batching, you'll probably get a message for each batch, I'm guessing, but that's not so bad.

JonMcL’s picture

Tested #12 and working for me. Updated 203 nodes.

casey’s picture

Status: Needs review » Reviewed & tested by the community

Works perfectly + I only see a single message after running a batch (tested on ~10000 items)

kalis1’s picture

#12 works well for me too ! Thank you !

Dave Reid’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Committed #12 to Git witha a couple of modifications to 7.x-1.x.
http://drupalcode.org/project/pathauto.git/commit/e15a16a

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

szy’s picture

+ 'pathauto_taxonomy_term_update_action' => array(
+ 'type' => 'taxonomy_term',
+ 'label' => t('Update taxonomy term alias'),
+ 'configurable' => FALSE,
+ 'triggers' => array('taxonomy_term_insert', 'taxonomy_term_update'),

The patch was applied with success, but I cannot see
option 'Update taxonomy term alias' in VBO term views.
Do you have an idea why?

Is it working fine in your views?

Thanks.

Szy.

szy’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Closed (fixed) » Active
Dave Reid’s picture

Note that this was *only* committed to the Drupal 7 version of Pathauto and the patch was not intended to be applied to the Drupal 6 version at all. It does make sense to properly backport this.

Dave Reid’s picture

Status: Active » Fixed

Backported the hook_action_info() integration to 6.x-2.x and committed to Git: http://drupalcode.org/project/pathauto.git/commit/05f1d48. Tested a node, user, and term VBO view in Drupal 6 and they're working as expected. This will be included in the next official release, or in the 6.x-2.x-dev release after about 12 hours.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.