You are here

function uc_catalog_settings_form in Ubercart 6.2

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

Catalog settings form.

Configure 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 24
Catalog administration menu items.

Code

function uc_catalog_settings_form() {
  $form = array();
  $vid = variable_get('uc_catalog_vid', NULL);
  if ($vid) {
    $catalog = taxonomy_vocabulary_load($vid);
    $form['catalog_vid'] = array(
      '#prefix' => '<div>',
      '#summary' => t('The taxonomy vocabulary <a href="!edit-url">%name</a> is set as the product catalog.', array(
        '!edit-url' => url('admin/content/taxonomy/' . $vid),
        '%name' => $catalog->name,
      )),
      '#suffix' => '</div>',
    );
    $form['catalog_vid']['#value'] = $form['catalog_vid']['#summary'];
  }
  $vocabs = array();
  $vocabularies = taxonomy_get_vocabularies();
  foreach ($vocabularies as $vid => $vocabulary) {
    $vocabs[$vid] = $vocabulary->name;
  }

  // JTR - catalog-top-level sub-textfield
  $form['catalog-top-level'] = array(
    '#type' => 'fieldset',
    '#title' => t('Catalog top level'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#summary callback' => 'summarize_form',
    '#attributes' => array(
      'class' => 'catalog-top-level',
    ),
  );
  $form['catalog-top-level']['uc_catalog_vid'] = array(
    '#type' => 'select',
    '#title' => t('Catalog vocabulary'),
    '#description' => t("The taxonomy vocabulary that will be considered the product catalog."),
    '#default_value' => variable_get('uc_catalog_vid', 0),
    '#summary callback' => 'summarize_null',
    '#options' => $vocabs,
  );
  $form['catalog-top-level']['uc_catalog_breadcrumb'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display the catalog breadcrumb'),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('Catalog breadcrumb is being displayed.'),
      t('Catalog breadcrumb is hidden.'),
    ),
    '#default_value' => variable_get('uc_catalog_breadcrumb', TRUE),
  );
  $form['catalog-top-level']['uc_catalog_breadcrumb_nodecount'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display node counts in the catalog breadcrumb'),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('Node count is being displayed in the catalog breadcrumb.'),
      t('Node count is not being displayed in the catalog breadcrumb.'),
    ),
    '#default_value' => variable_get('uc_catalog_breadcrumb_nodecount', FALSE),
  );
  $form['catalog-top-level']['uc_catalog_show_subcategories'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display subcategories in the catalog view'),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('The catalog view is displaying subcategories.'),
      t('The catalog view is not displaying subcategories.'),
    ),
    '#default_value' => variable_get('uc_catalog_show_subcategories', TRUE),
  );
  $form['catalog-top-level']['uc_catalog_category_columns'] = array(
    '#type' => 'select',
    '#title' => t('Number of columns in the grid of categories'),
    '#default_value' => variable_get('uc_catalog_category_columns', 3),
    '#summary' => t('Subcategories are being displayed in @columns columns.', array(
      '@columns' => variable_get('uc_catalog_category_columns', 3),
    )),
    '#options' => drupal_map_assoc(uc_range(1, 5)),
  );
  $form['catalog-products-list'] = array(
    '#type' => 'fieldset',
    '#title' => t('Catalog products list'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#summary callback' => 'summarize_form',
    '#attributes' => array(
      'class' => 'catalog-products-list',
    ),
  );
  $form['catalog-products-list']['uc_product_nodes_per_page'] = array(
    '#type' => 'textfield',
    '#title' => t('Product nodes per page'),
    '#summary' => t('There are @nodes product nodes displayed per page.', array(
      '@nodes' => variable_get('uc_product_nodes_per_page', 12),
    )),
    '#default_value' => variable_get('uc_product_nodes_per_page', 12),
    '#description' => t("Determines how many products will be listed on every catalog category. Notice that if you are using grid display it must be multiple of the grid width value, otherwise the last row will not match."),
    '#size' => 2,
  );
  $form['block-display'] = array(
    '#type' => 'fieldset',
    '#title' => t('Catalog block settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#summary callback' => '_uc_catalog_block_summarize',
    '#attributes' => array(
      'class' => 'block-display',
    ),
  );
  $form['block-display']['uc_catalog_block_title'] = array(
    '#type' => 'checkbox',
    '#title' => t('Make the block title a link to the top-level catalog page.'),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('Block title is pointing to the top-level catalog page.'),
      t('Block title is not pointing to the top-level catalog page.'),
    ),
    '#default_value' => variable_get('uc_catalog_block_title', FALSE),
  );
  $form['block-display']['uc_catalog_expand_categories'] = array(
    '#type' => 'checkbox',
    '#title' => t('Always expand categories in the catalog block'),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('Expanding categories in the catalog block.'),
      t('Not expanding categories in the catalog block.'),
    ),
    '#default_value' => variable_get('uc_catalog_expand_categories', FALSE),
  );
  $form['block-display']['uc_catalog_block_nodecount'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display node counts in the catalog block'),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('The number of nodes in a category are being shown in the catalog block.'),
      t('The number of nodes in a category are not being shown in the catalog block.'),
    ),
    '#default_value' => variable_get('uc_catalog_block_nodecount', TRUE),
  );
  return system_settings_form($form);
}