You are here

function taxonomy_facets_admin_settings in Taxonomy Facets 7.3

Same name and namespace in other branches
  1. 7.2 taxonomy_facets.inc \taxonomy_facets_admin_settings()

Provides admin page.

Parameters

array $form: Admin form.

array $form_state: Admin form.

Return value

array returns admin form

1 string reference to 'taxonomy_facets_admin_settings'
taxonomy_facets_menu in ./taxonomy_facets.module
Implements hook_menu().

File

./taxonomy_facets.inc, line 19
Taxo Faceted Navigation module administration screens.

Code

function taxonomy_facets_admin_settings(array $form, array &$form_state) {
  $form['taxonomy_facets_first_argument'] = array(
    '#type' => 'textfield',
    '#title' => t('First argument'),
    '#size' => 60,
    '#maxlength' => 250,
    '#default_value' => variable_get('taxonomy_facets_first_argument', 'items_list'),
    '#required' => TRUE,
    '#description' => t('First argument in the url, this is necessary for the working of this module. For example, for an ecommerce site the argument could be "products", so the URL would look something like http://yoursite.com/products/hardware/monitors. Cannot be null. Be careful not to use name produced by Token/Pathauto used to generate clean url.s'),
  );

  // ************ Display text about showing sub nodes ****.
  $form['show_subnodes'] = array(
    '#type' => 'fieldset',
    '#title' => t('Show nodes associated with children terms.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['show_subnodes']['show_subnodes_text'] = array(
    '#markup' => 'If you use a hierarchy of terms, for example:   Computers -> Desktop -> Workstation and if you associate the node with a bottom level term,
    say "Workstation", then the node will not appear when you click on a parent filter, say "Computers" or "Desktop".  To show a node in this case you need to associate the node with <strong>all</strong> of the parents of the child term as well i.e. all 3 terms from the example hierarchy,
    that would be Computers, Desktop and Workstation.  To be able to do that, when you create your node definition and when you add a "Term Reference" field,
    make sure you set "Number of values" to unlimited. Then when an editor creates a node they need to select the terms from all levels in the hierarchy, i.e. 
    Computers, Desktop and Workstation. Optionally you can install the  <a href="https://www.drupal.org/project/multiselect" target="_blank">Multiselect module</a>
    to make it easier for editors to select multiple terms.',
  );
  $form['show_subnodes']['taxonomy_facets_show_subnodes_checkbox'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show warning on node save.'),
    '#default_value' => variable_get('taxonomy_facets_show_subnodes_checkbox', FALSE),
    '#description' => t('If a node is associated with a child term, and you wish the node to appear when user selects parent filter, then make sure you associate the
     node with all appropriate terms as described above. When this checkbox is checked a warning will appear if the node is not associated correctly with all parent
     terms in the hierarchy.'),
  );

  // ************************************************************************.
  $form['taxonomy_facets_display_link_if_empty'] = array(
    '#type' => 'checkbox',
    '#title' => t('Do not display link if empty'),
    '#default_value' => variable_get('taxonomy_facets_display_link_if_empty', FALSE),
    '#description' => t('If there are no nodes under particular link, do not display it.'),
  );
  $form['taxonomy_facets_display_link_if_intersection_empty'] = array(
    '#type' => 'checkbox',
    '#title' => t('Do not display link if the intersection of terms is empty'),
    '#default_value' => variable_get('taxonomy_facets_display_link_if_intersection_empty', FALSE),
    '#description' => t('Do not display link if there are no nodes under particular link, but also taking into account current filter selection: i.e if there are no nodes for current filter combination. Works well only for flat hierarchies, i.e. single level hierarchy'),
  );
  $form['taxonomy_facets_redirect_to_home'] = array(
    '#type' => 'checkbox',
    '#title' => t('Redirect to page if no filters applied'),
    '#default_value' => variable_get('taxonomy_facets_redirect_to_home', FALSE),
    '#description' => t('If no arguments passed as filters, i.e if all filters deselected, then redirect to home page. If this checkbox is checked and the field below is empty redirect to home page. If this check box is unchecked all nodes will appear, this is similar behavior as on sitename.com/node page.'),
  );
  $form['taxonomy_facets_redirect_to_page'] = array(
    '#type' => 'textfield',
    '#title' => t('Redirect to a page if no filters applied'),
    '#default_value' => variable_get('taxonomy_facets_redirect_to_page', FALSE),
    '#description' => t('If no arguments passed as filters, i.e if all filters deselected, redirect to a specified page. NOTE: Make sure to check the "Redirect to page..." check box above and specify the page url in this field. If you want to redirect to the home page just leave this field empty.'),
  );
  $form['taxonomy_facets_ignore_language_prefix'] = array(
    '#type' => 'checkbox',
    '#title' => t('Ignore language prefix'),
    '#default_value' => variable_get('taxonomy_facets_ignore_language_prefix', FALSE),
    '#description' => t('If you check this box, the setting will force filters links to stay unchanged and language independent, so <strong>no</strong> language prefix will be added in the url.'),
  );

  // ******* Display text about configuring taxonomy paterns *****************.
  $form['set_taxo_patterns'] = array(
    '#type' => 'fieldset',
    '#title' => t('Set taxonomy patterns'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['set_taxo_patterns']['set_taxo_patterns_text'] = array(
    '#markup' => ' Go to:  <br>
       Administration > Configuration > Search and metadata > URL aliases > <a href="/admin/config/search/path/patterns">Patterns</a>
       <br>
       In the TAXONOMY TERM PATHS section configure term patterns, change it to
       single argument. <br>For example change default pattern:
       [term:vocabulary]/[term:name] to [term:name].<br>
       You can use [term:vocabulary]-[term:name] or similar, the key is NOT to have
       any / character in the pattern, as this module expects a single argument for
                each filter.<br><br>
              If you already have taxonomy term aliases generated with a different pattern then update them:<br>
        * <a href="/admin/config/search/path/delete_bulk"> Delete aliases for taxonomy terms.</a><br>
        * <a href="/admin/config/search/path/update_bulk">Bulk update taxonomy term paths</a><br>.
        ',
  );

  // **************************** Select content type ***********************.
  $form['content_types'] = array(
    '#type' => 'fieldset',
    '#title' => t('Select content types'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['content_types']['taxonomy_facets_content_type_options'] = array(
    '#type' => 'checkboxes',
    '#options' => taxo_faceted_get_node_types(),
    '#default_value' => variable_get('taxonomy_facets_content_type_options', array()),
    '#title' => t('What content types should be displayed on taxonomy facets listing page,
    i.e the page that you specified in the "First argument" field above?'),
  );

  // ********** Display text about adding taxo facets block  *****************.
  $form['set_taxo_block'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add taxonomy faceted navigation blocks'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['set_taxo_block']['set_taxo_block_text'] = array(
    '#markup' => ' Go to:  <br>
      Administration > Structure > <a href="/admin/structure/block">Blocks</a>
      <br>
      Click on <a href="/admin/structure/block/add-taxofacet-block">"Add taxofacet block"</a>
      <br>Select desired taxonomy.
      <br>In the visibility settings set desired options. For example: if your "First argument" is "items_list" then
      in the  "Show block on specific pages"
      <br>
      Click on "Only the listed pages" radio button
      <br>
      and set it to: items_list*
      <br>.
      ',
  );

  // **************** Display text about theming  ****************************.
  $form['set_taxo_theme'] = array(
    '#type' => 'fieldset',
    '#title' => t('Theme templates'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['set_taxo_theme']['set_taxo_theme_text'] = array(
    '#markup' => t('There are 4 templates that you can use to theme your filter blocks. Simply copy all the files from the templates folder, that resides inside this module, into your theme template folder.'),
  );
  return system_settings_form($form);
}