'BeautyTips', 'page callback' => 'drupal_get_form', 'page arguments' => array('beautytips_admin'), 'access arguments' => array('administer site configuration'), 'file' => 'beautytips.admin.inc', ); return $items; } /** * This is the API. Call this function to add beautytips. * * @param array $options - See README.txt for details */ function beautytips_add_beautytips($options = NULL) { static $added = FALSE; $settings = array('beautytips' => array()); $js_added = drupal_add_js($data = NULL, 'setting'); if (count($options)) { foreach ($options as $beautytip => $content) { // Ensure the js settings are not added more than once if (isset($js_added['setting']) && is_array($js_added['setting'])) { foreach ($js_added['setting'] as $setting) { if (is_array($setting['beautytips'])) { if (array_key_exists($beautytip, $setting['beautytips'])) { unset($content); } } } } // Setup the settings array for adding js if (is_array($content)) { $style = isset($content['style']) ? $content['style'] : 'default'; $settings['beautytips'][$beautytip] = array_merge(beautytips_get_style($style), $content); $keys_no_add = array('cssSelect', 'style', 'list', 'text', 'preEval', 'ajaxDisableLink'); foreach ($settings['beautytips'][$beautytip] as $key => $value) { if (!in_array($key, $keys_no_add)) { $settings['beautytips'][$beautytip]['list'][] = $key; } } } } if ($added && !empty($settings['beautytips'])) { drupal_add_js($settings, 'setting'); } } // Add beautytips jQuery plugin if (!$added) { $path = drupal_get_path('module', 'beautytips'); //for IE add this $expath = $path . '/other_libs/excanvas_r3'; if (count(file_scan_directory($expath, 'excanvas.js', array('.', '..', 'CVS'), 0, FALSE))) { drupal_add_js($expath . '/excanvas.compiled.js'); } drupal_add_js($path . '/js/jquery.bt.min.js'); drupal_add_js($path . '/js/beautytips.js'); drupal_add_js($settings, 'setting'); $added = TRUE; } } /** * Get all the defined beautytips styles */ function beautytips_get_styles($reload = FALSE) { $cache = cache_get('beautytips:beautytips-styles'); if (!$cache || $reload) { $styles = module_invoke_all('define_beautytips_styles'); // Save the beautytips style registry in the cache. cache_set('beautytips:beautytips-styles', $styles); } else { $styles = $cache->data; } return $styles; } /** * Get an array of options that defines a particular style */ function beautytips_get_style($style = 'default') { $styles = beautytips_get_styles(); return isset($styles[$style]) ? $styles[$style] : array(); } /** * Implementation of hook_define_beautytips_styles(). * * @return $styles - an array of different styles */ function beautytips_define_beautytips_styles() { $styles['default'] = variable_get('beautytips_defaults', array()); $styles['plain'] = array( //'cssStyles' => array(), ); $styles['netflix'] = array( 'positions' => array('right', 'left'), 'fill' => '#FFF', 'padding' => 5, 'shadow' => TRUE, 'shadowBlur' => 12, 'strokeStyle' => '#B9090B', 'spikeLength' => 50, 'spikeGirth' => 60, 'cornerRadius' => 10, 'centerPointY' => .1, 'overlap' => -8, 'cssStyles' => array( 'fontSize' => '12px', 'fontFamily' => 'arial,helvetica,sans-serif', ), ); $styles['facebook'] = array( 'fill' => '#F7F7F7', 'padding' => 8, 'strokeStyle' => '#B7B7B7', 'cornerRadius' => 0, 'cssStyles' => array( 'fontFamily' => '"lucida grande",tahoma,verdana,arial,sans-serif', 'fontSize' => '11px', ), ); $styles['transparent'] = array( 'fill' => 'rgba(0, 0, 0, .8)', 'padding' => 20, 'strokeStyle' => '#CC0', 'strokeWidth' => 3, 'spikeLength' => 40, 'spikeGirth' => 40, 'cornerRadius' => 40, 'cssStyles' => array( 'color' => '#FFF', 'fontWeight' => 'bold', ), ); $styles['big-green'] = array( 'fill' => '#00FF4E', 'padding' => 20, 'strokeWidth' => 0, 'spikeLength' => 40, 'spikeGirth' => 40, 'cornerRadius' => 15, 'cssStyles' => array( 'fontFamily' => '"lucida grande",tahoma,verdana,arial,sans-serif', 'fontSize' => '14px', ), ); $styles['google-maps'] = array( 'positions' => array(0 => 'top', 1 => 'bottom'), 'fill' => '#FFF', 'padding' => 15, 'strokeStyle' => '#ABABAB', 'strokeWidth' => 1, 'spikeLength' => 65, 'spikeGirth' => 40, 'cornerRadius' => 25, 'centerPointX' => .9, 'cssStyles' => array(), ); $styles['hulu'] = array( 'fill' => '#F4F4F4', 'strokeStyle' => '#666666', 'spikeLength' => 20, 'spikeGirth' => 10, 'width' => 350, 'overlap' => 0, 'centerPointY' => 1, 'cornerRadius' => 0, 'cssStyles' => array( 'fontFamily' => '"Lucida Grande",Helvetica,Arial,Verdana,sans-serif', 'fontSize' => '12px', 'padding' => '10px 14px' ), 'shadow' => TRUE, 'shadowColor' => 'rgba(0,0,0,.5)', 'shadowBlur' => 8, 'shadowOffsetX' => 4, 'shadowOffsetY' => 4, ); return $styles; }