You are here

function theme_workflow_fields_state in Workflow Fields 7

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

Theme function for workflow state form.

1 theme call to theme_workflow_fields_state()
workflow_fields_form_workflow_admin_ui_form in ./workflow_fields.module
Administration form that renders a table listing of the fields for workflow's content type.

File

./workflow_fields.module, line 269
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($vars) {
  $element =& $vars['element'];
  $header = array(
    t('Content type'),
    t('Field name'),
    t('Visible'),
    t('Editable'),
    t('Select'),
  );
  $rows = array();
  foreach (element_children($element) as $type) {
    $type_info = node_type_get_type($type);
    foreach (element_children($element[$type]) as $field_name) {
      $field_label = $element[$type][$field_name]['#field_label'];
      $rows[] = array(
        $type_info->name . '<br/>(' . $type . ')',
        $field_label . '<br/>(' . $field_name . ')',
        drupal_render($element[$type][$field_name]['visible']),
        drupal_render($element[$type][$field_name]['editable']),
        drupal_render($element[$type][$field_name]['shortcuts']),
      );
    }
  }
  $attributes = array(
    'class' => array(
      'workflow-fields-table',
    ),
  );
  $output = theme('table', compact('header', 'rows', 'attributes')) . '<p />';
  return $output;
}