You are here

function opigno_tincan_question_type_form_opigno_tincan_question_type_node_form_alter in Opigno TinCan Question Type 7

Implements hook_form_FORM_ID_alter().

File

./opigno_tincan_question_type.module, line 37
The main module file which contains the main drupal hooks.

Code

function opigno_tincan_question_type_form_opigno_tincan_question_type_node_form_alter(&$form, &$form_state, $form_id) {

  // Check if the TinCanPHP library is installed.
  // If it is not installed, the user cannot access and an error message is given
  $libraries = libraries_get_libraries();
  if (!isset($libraries['TinCanPHP'])) {
    drupal_set_message(t('You will not be able to save this question.'), 'error');
    drupal_set_message(t('Please install the !tincanphp_library in the <em>sites/all/library/TinCanPHP</em> folder.', array(
      '!tincanphp_library' => l(t('TinCanPHP library'), 'https://github.com/RusticiSoftware/TinCanPHP/releases'),
    )), 'error');
  }
  $form['#validate'][] = 'opigno_tincan_question_type_form_opigno_tincan_question_type_node_form_validate';
}