You are here

function uc_catalog_settings_form in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 uc_catalog/uc_catalog.admin.inc \uc_catalog_settings_form()

Catalog settings form.

Configures the display of the catalog breadcrumb.

1 string reference to 'uc_catalog_settings_form'
uc_catalog_menu in uc_catalog/uc_catalog.module
Implements hook_menu().

File

uc_catalog/uc_catalog.admin.inc, line 15
Catalog administration menu items.

Code

function uc_catalog_settings_form($form, &$form_state) {
  $view = views_get_view('uc_catalog');
  $displays = array();
  foreach ($view->display as $display) {
    if ($display->display_plugin == 'page') {
      $displays[$display->id] = $display->display_title;
    }
  }
  $form['catalog-top-level']['uc_catalog_display'] = array(
    '#type' => 'select',
    '#title' => t('Catalog display'),
    '#default_value' => variable_get('uc_catalog_display', 'catalog'),
    '#options' => $displays,
  );
  $vid = variable_get('uc_catalog_vid', NULL);
  if ($vid) {
    $catalog = taxonomy_vocabulary_load($vid);
    $form['catalog_vid'] = array(
      '#markup' => '<p>' . t('The taxonomy vocabulary <a href="!edit-url">%name</a> is set as the product catalog.', array(
        '!edit-url' => url('admin/structure/taxonomy/' . $catalog->machine_name),
        '%name' => $catalog->name,
      )) . '</p>',
    );
  }
  $vocabs = array();
  $vocabularies = taxonomy_vocabulary_load_multiple(FALSE);
  foreach ($vocabularies as $vid => $vocabulary) {
    $vocabs[$vid] = $vocabulary->name;
  }
  $form['catalog-top-level']['uc_catalog_vid'] = array(
    '#type' => 'select',
    '#title' => t('Catalog vocabulary'),
    '#default_value' => variable_get('uc_catalog_vid', 0),
    '#options' => $vocabs,
  );
  $form['catalog-top-level']['uc_catalog_breadcrumb'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display the catalog breadcrumb'),
    '#default_value' => variable_get('uc_catalog_breadcrumb', TRUE),
  );
  return system_settings_form($form);
}