You are here

function certificate_certificate_map_options in Certificate 7.3

Same name and namespace in other branches
  1. 8.3 certificate.module \certificate_certificate_map_options()
  2. 6.2 certificate.module \certificate_certificate_map_options()
  3. 7.2 certificate.module \certificate_certificate_map_options()
  4. 3.x certificate.module \certificate_certificate_map_options()

Implements hook_certificate_map_options().

Provide a list of options to the user that can be mapped to certificate templates.

Return value

Array of mapping sets.

File

./certificate.module, line 686
Certificate module.

Code

function certificate_certificate_map_options() {
  $options = array();
  if (module_exists('rules')) {
    $rules = array();
    foreach (rules_get_components() as $key => $ruleset) {
      if (array_search('certificate', $ruleset->tags) !== FALSE) {
        $rules[$key] = $ruleset->label;
      }
    }
    $options['rules'] = array(
      'title' => t('Rules'),
      'options' => $rules,
      'description' => t('When a rule or ruleset ends with "Award certificate", the selected certificate will be awarded.'),
    );
  }
  $fieldgroups = variable_get('certificate_field_groups', array());
  if (!empty($fieldgroups)) {
    $options['profile'] = array(
      'title' => t('Profiles'),
      'options' => $fieldgroups,
      'description' => t("If the user's profile matches a value in a field group, the selected certificate will be awarded."),
    );
  }
  $options['manual'] = array(
    'title' => t('Manual'),
    'description' => t('Select a single certificate to award to the user.'),
    'options' => array(
      'manual' => 'Manual',
    ),
  );
  return $options;
}