You are here

function theme_workflow_fields_state in Workflow Fields 6

Same name and namespace in other branches
  1. 5 workflow_fields.module \theme_workflow_fields_state()
  2. 7 workflow_fields.module \theme_workflow_fields_state()

Theme function for workflow state form.

1 theme call to theme_workflow_fields_state()
_workflow_fields_state_form_alter in ./workflow_fields.module
Helper functino to alter the workflow state form. Add a table listing the fields for workflow's content type.

File

./workflow_fields.module, line 212
This module adds to workflow.module the ability to specify, for each state, which node fields should be visible and/or editable. It is a useful feature when workflows demand that certain information be hidden or read-only to certain roles.

Code

function theme_workflow_fields_state($form) {
  $header = array(
    t('Content type'),
    t('Field name'),
    t('Visible'),
    t('Editable'),
    t('Select'),
  );
  $rows = array();
  foreach ($form['#types']['#value'] as $type) {
    $content = content_types($type);
    $fields = _workflow_fields_get_extra_fields($type) + $content['fields'];
    foreach ($fields as $field) {
      $rows[] = array(
        $content['name'] . '<br/>(' . $type . ')',
        $field['widget']['label'] . '<br/>(' . $field['field_name'] . ')',
        drupal_render($form[$type][$field['field_name']]['visible']),
        drupal_render($form[$type][$field['field_name']]['editable']),
        drupal_render($form[$type][$field['field_name']]['shortcuts']),
      );
    }
  }
  $output = theme('table', $header, $rows, array(
    'class' => 'workflow-fields-table',
  )) . '<p />';
  return $output;
}