You are here

function metatags_quick_upgrade in Meta tags quick 8.3

Same name and namespace in other branches
  1. 7.2 metatags_quick_import.admin.inc \metatags_quick_upgrade()

@file upgrade path from the D6 nodewords module @author maxiorel <http://drupal.org/user/49016> @author valthebald <http://drupal.org/user/239562>

1 string reference to 'metatags_quick_upgrade'
metatags_quick_import_menu in ./metatags_quick_import.module
Implements hook_menu().

File

./metatags_quick_import.admin.inc, line 8
upgrade path from the D6 nodewords module @author maxiorel <http://drupal.org/user/49016> @author valthebald <http://drupal.org/user/239562>

Code

function metatags_quick_upgrade() {
  if (db_table_exists('nodewords')) {
    module_load_include('inc', 'metatags_quick', 'known_tags');
    $form['description'] = array(
      '#type' => 'markup',
      '#markup' => '<p>' . t('This utility will convert existing nodewords to the Drupal 7 fields.') . '</p>',
    );
    $form['create_fields'] = array(
      '#title' => t('Create fields'),
      '#description' => t('Create fields if they do not exist.'),
      '#type' => 'checkbox',
      '#return_value' => '1',
      '#default_value' => '1',
    );
    $fields = variable_get('nodewords_edit', array());
    $options = drupal_map_assoc(array_keys(_metatags_quick_known_fields()));
    $form['fields_select'] = array(
      '#title' => t('Fields to import'),
      '#description' => t('Field list is taken from nodewords settings.'),
      '#type' => 'checkboxes',
      '#required' => TRUE,
      '#options' => $options,
      '#default_value' => $fields,
    );
    $form['batch_size'] = array(
      '#type' => 'textfield',
      '#default_value' => '100',
      '#description' => t('How many nodes to process during one iteration'),
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Convert'),
    );
  }
  else {
    $form['description'] = array(
      '#markup' => t('Nodewords table not found. Please check your installation'),
    );
  }
  return $form;
}