You are here

function certificate_field_attach_form in Certificate 7.2

Same name and namespace in other branches
  1. 8.3 certificate.module \certificate_field_attach_form()
  2. 7.3 certificate.module \certificate_field_attach_form()
  3. 3.x certificate.module \certificate_field_attach_form()

Implements hook_field_attach_form().

File

./certificate.module, line 302
Certificate module.

Code

function certificate_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
  if ($entity_type == 'node' && certificate_node_is_certifiable($entity)) {

    // Add per-node certificate settings.
    module_load_include('inc', 'certificate', 'certificate.admin');
    certificate_alter_node_form($form, $form_state);
  }
  if ($entity_type == 'node' && $entity->type == 'certificate') {
    if (module_exists('token')) {

      // Embed token help.
      $form['certificate_tokens'] = array(
        '#title' => 'Certificate tokens',
        '#markup' => theme('token_tree', array(
          'token_types' => array(
            'global',
            'node',
            'user',
            'certificate',
          ),
        )),
      );
    }
  }
}