$t('Spaces Custom Text compatibility'), 'description' => $t('Spaces Custom Text is not compatible with the Locale module. Either Spaces Custom Text or Locale must be disabled.'), 'severity' => REQUIREMENT_ERROR, 'value' => $t('Incompatible'), ); } } return $requirements; } /** * Implementation of hook_enable(). * Weight spaces_customtext as the lowest possible module. */ function spaces_customtext_enable() { $min = db_result(db_query("SELECT weight FROM {system} WHERE type = 'module' ORDER BY weight ASC LIMIT 1")); $weight = $min < -10000 ? $min - 1 : -10000; db_query("UPDATE {system} SET weight = %d WHERE name = 'spaces_customtext' AND type = 'module'", $weight); } /** * Implementation of hook_init(). */ function spaces_customtext_init() { global $language; spaces_customtext_cache($language->language); $language->language = 'spaces_customtext'; } /** * Simple static cache for storing the actual language code for the current * page request. */ function spaces_customtext_cache($langcode = NULL, $reset = FALSE) { static $cache; if ($reset) { unset($cache); } $cache = isset($langcode) ? $langcode : $cache; return isset($cache) ? $cache : NULL; } /** * Implementation of hook_spaces_plugins(). */ function spaces_customtext_spaces_plugins() { return array( 'spaces_controller_customtext' => array( 'handler' => array( 'path' => drupal_get_path('module', 'spaces_customtext') .'/plugins', 'file' => 'spaces_controller_customtext.inc', 'class' => 'spaces_controller_customtext', 'parent' => 'spaces_controller_variable', ), ), ); } /** * Implementation of hook_menu(). */ function spaces_customtext_menu() { return array( 'features/customtext/%' => array( 'access callback' => 'spaces_customtext_menu_access', 'access arguments' => array(), 'file' => 'spaces_customtext.admin.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('spaces_customtext_settings_form', 2), 'title' => 'Settings', 'type' => MENU_CALLBACK, ), ); } /** * Access callback for custom text. */ function spaces_customtext_menu_access() { return spaces_access_admin() && user_access('administer string overrides'); } /** * Implementation of hook_form_alter() for spaces_features_form. */ function spaces_customtext_form_spaces_features_form_alter(&$form, &$form_state) { $parent = menu_get_item(); foreach (element_children($form['settings']) as $feature) { $link = l(t('Customize text'), "{$parent['href']}/customtext/{$feature}"); $link = !empty($form['settings'][$feature]['#value']) ? " | {$link}" : $link; $form['settings'][$feature]['#value'] .= $link; } } /** * Implementation of hook_theme(). */ function spaces_customtext_theme() { return array( 'spaces_customtext_settings_form' => array( 'arguments' => array(), ), ); } /** * Implementation of hook_perm(). * Note that this is the same perm provided by the stringoverrides module. */ function spaces_customtext_perm() { return array('administer string overrides'); }