Index: cc_widget.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/cc_widget/cc_widget.module,v retrieving revision 1.3.2.1 diff -u -p -r1.3.2.1 cc_widget.module --- cc_widget.module 17 Sep 2008 18:39:26 -0000 1.3.2.1 +++ cc_widget.module 24 Sep 2008 23:51:38 -0000 @@ -1,6 +1,10 @@ data, $matches); - + preg_match($regex, $result->data, $matches); drupal_set_message(t('Setting license version %version, latest for selected jurisdiction %jurisdiction.', array('%version' => $matches[2], '%jurisdiction' => $form_values['cc_widget_jurisdiction']))); form_set_value($form['cc_widget_version'], $matches[2]); + variable_set('cc_widget_version', $form_values['cc_widget_version']); } + +/** + * custom submit handler for the admin settings form + * @param string $form_id + * @param array $form_values + */ function cc_widget_admin_settings_submit($form_id, $form_values) { + // we need to save this data as we are overriding the standard submit handler + variable_set('cc_widget_version', $form_values['cc_widget_version']); + variable_set('cc_widget_jurisdiction', $form_values['cc_widget_jurisdiction']); + variable_set('cc_widget_dimensions', $form_values['cc_widget_dimensions']); + // now clean out any left over settings cc_widget_clear_cache(); } + +/** + * runs a cache clear to remove old CC data from the system + */ +function cc_widget_clear_cache() { + cache_clear_all('cc_widget_data', 'cache'); + cc_widget_preset_widget_options(TRUE); +} + + +/** + * crates the options + * @param boolean $reset + * controls if cache should be used or not + */ function cc_widget_preset_widget_options($reset = FALSE) { static $types; @@ -131,13 +181,13 @@ function cc_widget_preset_widget_options return $types; } -function cc_widget_clear_cache() { - cache_clear_all('cc_widget_data', 'cache'); - cc_widget_preset_widget_options(TRUE); -} +/** + * does the actual theming of the the widget display + * @param array $option + * @return html + */ function theme_cc_widget_cc_field_value($option) { $image = theme('image', $option['#image'], $option['#title'], $option['#title'], NULL, FALSE); return l($image, $option['#link'], array('rel' => 'license'), NULL, NULL, TRUE, TRUE); -} - +} \ No newline at end of file