You are here

function similarterms_block_configure in Similar By Terms 7

Same name and namespace in other branches
  1. 6 similarterms.module \similarterms_block_configure()

Implements hook_block_configure().

File

./similarterms.module, line 80
Similar By Terms module displays a block with similar content based on taxonomy terms.

Code

function similarterms_block_configure($delta = '') {
  $form['count'] = array(
    '#type' => 'textfield',
    '#title' => t('Item count'),
    '#default_value' => variable_get('similarterms_count_' . $delta, 5),
    '#size' => 3,
    '#description' => t('The maximum number of similar items to display'),
  );

  //petertj addition to configuration to permit display of current node in list
  $form['showcurrentnode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show current node as active in the list'),
    '#default_value' => variable_get('similarterms_showcurrentnode_' . $delta, FALSE),
    '#required' => FALSE,
  );

  //mimo addition to configuration to limit to same page type
  $types = array(
    '0' => t('<none>'),
    '1' => t('same as current'),
  );
  $arr_types_obj = node_type_get_types();
  foreach ($arr_types_obj as $type => $obj) {
    $types[$type] = $obj->name;
  }
  $form['sametype'] = array(
    '#type' => 'select',
    '#title' => t('Content type limit'),
    '#default_value' => variable_get('similarterms_sametype_' . $delta, FALSE),
    '#options' => $types,
    '#description' => t('Limit to pages of this or these content type(s)'),
    '#multiple' => TRUE,
  );
  if ($delta != 'all') {
    $terms = array();
    $tree = $delta;
    foreach ($tree as $term) {
      $terms[$term->tid] = $term->name;
    }
    $form['ignoreterms'] = array(
      '#type' => 'select',
      '#title' => t('Terms to be ignored'),
      '#default_value' => variable_get('similarterms_ignoreterms_' . $delta, array()),
      '#options' => $terms,
      '#description' => t('Ignore selected terms here from being used to search for similar entries'),
      '#multiple' => TRUE,
    );
  }
  return $form;
}