You are here

function workflow_field_extra_fields in Workflow 7.2

Same name and namespace in other branches
  1. 7 workflow.node.inc \workflow_field_extra_fields()

Implements hook_field_extra_fields().

We do not use 'extra fields controller class', which only adds 'display' fields, not 'form' fields. Use hook_field_extra_fields instead.

hook_field_extra_fields() is invoked by _field_extra_fields_pre_render(), which is a pre-render function used by field_attach_form(), and field_attach_view().

See also

https://api.drupal.org/api/drupal/modules!field!field.api.php/function/h...

http://drupal.stackexchange.com/questions/10527/how-should-i-use-hook-fi...

File

./workflow.entity.inc, line 420
Integrates workflow with entity API.

Code

function workflow_field_extra_fields() {
  $extra = array();
  $entity_type = 'WorkflowTransition';
  $info = entity_get_info($entity_type);
  foreach ($info['bundles'] as $bundle => $bundle_info) {
    $extra[$entity_type][$bundle] = array(
      'form' => array(
        'workflow_sid' => array(
          'widget-type' => 'select',
          'label' => t('State Id'),
          'description' => t('Target state Id'),
          'weight' => -4,
        ),
        'scheduled_container' => array(
          'label' => t('Scheduling'),
          'description' => t('Schedule checkbox & date/time'),
          'weight' => -4,
        ),
        'workflow_comment' => array(
          'label' => t('Comment'),
          'description' => t('Comment text area'),
          'weight' => -4,
        ),
      ),
      'display' => array(),
    );
  }
  return $extra;
}