Currently, workflow_node_view() injects

  • the workflow state (workflow_current_state element) in all full node views
  • the workflow form (workflow element) in all full node views if user has permission to perform at least one state change

These data can be hidden in theme or removed in a hook_node_view_alter() implementation, but they should probably not be always exposed:

  • workflow_current_state should probably be controlled by a #access check, so that only roles allowed to see this information see it
  • workflow does not look like it needs a permission, since its internal behaviour is already controlled by workflow state access rules, however, it should probably be configurable, because it makes for heavy UI and not all sites will want it to be present both on the main page and the workflow tab. I think a configuration variable would be better

If you agree with either (or both) of these, I can roll a patch.

CommentFileSizeAuthor
#6 1893724a.patch3.56 KBNancyDru
#5 1893724.patch3.09 KBNancyDru
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

NancyDru’s picture

Please do roll a patch.

NancyDru’s picture

How does this look?

  if ($view_mode != 'full' || !workflow_field_choices($node)) {
    return;
  }
NancyDru’s picture

NancyDru’s picture

NancyDru’s picture

Status: Active » Needs review
FileSize
3.09 KB

Here's a patch

NancyDru’s picture

FileSize
3.56 KB

This one adds a permission so that even with state change rights, the form can be suppressed from the node view.

adamtong’s picture

This problem in #4 marked as duplicate but I try the patches at #6 didn't solve the error message of the following:

Notice: Undefined offset: 0 in workflow_node_view() (line 510 of /home/mallbar/www/demo13/sites/all/modules/workflow/workflow.module).
Notice: Trying to get property of non-object in workflow_node_view() (line 519 of /home/mallbar/www/demo13/sites/all/modules/workflow/workflow.module).
Notice: Undefined offset: 0 in workflow_tab_form() (line 127 of /home/mallbar/www/demo13/sites/all/modules/workflow/workflow.pages.inc).

NancyDru’s picture

Status: Needs review » Needs work

Hmm... I assume you've cleared the caches, even though that shouldn't matter.

NancyDru’s picture

@adamtong: At line 843, you should see:

    if ($workflow = workflow_get_workflow_type_map_by_type($node->type)) {
      $choices[$node->type] = FALSE;

Please reverse those two lines

    $choices[$node->type] = FALSE;
    if ($workflow = workflow_get_workflow_type_map_by_type($node->type)) {

Let me know, please.

NancyDru’s picture

Status: Needs work » Fixed

Committed to -dev.

Status: Fixed » Closed (fixed)

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