--- flexiconvert.module 18 aoĆ» 2008 22:34:40 -0400 1.8 +++ flexiconvert.module 30 avr 2009 14:20:19 -0400 @@ -59,7 +59,8 @@ $items[] = array( 'path' => 'admin/flexiconvert/convert', 'title' => t('Flexiconvert'), - 'callback' => 'flexiconvert_page', + 'callback' => 'drupal_get_form', + 'callback arguments' => array('flexiconvert_form'), 'access' => user_access('convert flexinode types'), ); } @@ -195,26 +196,21 @@ /** * Returns the form for converting Flexinode types to CCK types. * - * If CCK is not running correctly, an error message is set instead of a form. + * If CCK is not running correctly, set an error message + * Implementation of hook_form(). */ -function flexiconvert_page() { +function flexiconvert_form() { $cck_is_init = flexiconvert_cck_running(); if ($cck_is_init == FLEXICONVERT_CCK_DISABLED) { drupal_set_message(t('CCK module disabled or does not exist!'), 'error'); + return; } else if ($cck_is_init == FLEXICONVERT_CCK_ASSOCIATED_MODULES_DISABLED) { drupal_set_message(t('One or more of the packaged CCK field type modules is disabled!'), 'error'); + return; } - else { // CCK is running happily! Yay! - return drupal_get_form('flexiconvert_form'); - } -} -/** - * Implementation of hook_form(). - */ -function flexiconvert_form() { // Include a stylesheet because we need a pretty table-like appearance of the form. drupal_add_css('sites/all/modules/flexiconvert/flexiconvert_styles.css', 'module', 'all', TRUE); // Add jQuery code to select all the elements in the form.