attached is a patch, which brings workflow-ng integration to node hierarchy. it just adds a condition to check whether a node has a parent and an action, which allows one to load parent nodes for any content. This enables one, to use any rule / action on the parent.

This might be useful in a lot of cases. My use case is is setting custom breadcrumbs with tokens, that are not available for parents else. So I load the parent node with workflow-ng and then I use the tokens of the parent with the brand new workflow-ng action "Set breadcrumb" .

patch attached.

CommentFileSizeAuthor
node_hierarchy_workflow_ng_support.patch2.34 KBfago
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fago’s picture

Status: Active » Needs review
scottrigby’s picture

it works for me -- thanks fago!

scottrigby’s picture

I think this patch solves this issue: http://drupal.org/node/226120

ronan’s picture

Thanks for the patch. I'll take a look at it and try to get it committed as soon as I can.

Ronan

ronan’s picture

Status: Needs review » Fixed

Patch looks clean and seems to work, so I've committed it. I can't really verify functionality because I don't totally understand the use case. I'm very interested in what you're doing though, so if you wouldn't mind describing your technique I'd love to hear more about it.

Thanks again
Ronan

fago’s picture

thanks.

I use workflow-ng to set the breadcrumb for nodes. This is done by a rule like this one:

array (
  'cfg_142' => 
  array (
    '#active' => 1,
    '#altered' => false,
    '#module' => 'workflow-ng',
    '#event' => 'node_view',
    '#id' => 1,
    '#weight' => '0',
    '#label' => 'Set breadcrumb for child nodes',
    '#type' => 'configuration',
    0 => 
    array (
      '#type' => 'condition',
      '#name' => 'workflow_ng_condition_check_boolean',
      '#weight' => '-2',
      '#label' => 'Content is displayed as page',
      '#id' => 2,
      '#argument map' => 
      array (
        'page' => 'boolean',
      ),
    ),
    1 => 
    array (
      '#label' => 'Content is a child',
      '#name' => 'nodehierarchy_has_parent',
      '#type' => 'condition',
      '#id' => 3,
      '#argument map' => 
      array (
        'node' => 'node',
      ),
    ),
    2 => 
    array (
      '#id' => 4,
      '#type' => 'action',
      '#weight' => '-10',
      '#name' => 'nodehierarchy_action_load',
      '#argument map' => 
      array (
        'node' => 'node',
      ),
      '#new arguments' => 
      array (
        'node_parent' => 
        array (
          '#entity' => 'node',
          '#label' => 'Parent content',
          '#default_name' => 'node_parent',
        ),
      ),
    ),
    3 => 
    array (
      '#id' => 5,
      '#name' => 'workflow_ng_action_set_breadcrumb',
      '#type' => 'action',
      '#settings' => 
      array (
        'titles' => '[node:hierarchyparenttitle]
[node:title]',
        'titles_args' => 
        array (
          0 => 'node',
        ),
        'paths' => 'node/[node_parent:nid]
node/[node:nid]',
        'paths_args' => 
        array (
          0 => 'node',
          1 => 'node_parent',
        ),
      ),
    ),
    '#name' => 'cfg_142',
  ),
)

You can import it and try it yourself with the fresh workflow-ng 2.0. So with this, now one can easily use other tokens, that are not available by node hierarchy's token integration, e.g. a term of the parent.
However, it doesn't build the full hierarchy automatically. If you have grandparents, you would need to configure an action "load grandparent".

ronan’s picture

That's a really cool implementation, thanks for sharing that back.

R

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

mootoo1’s picture

where do i have to put this patch ?
i have custom breadcrumbs installed and i what to have the breadcrumbs also in the view page and in some specific urls

is this the patch i need to make it ?

10x