You are here

function similarterms_block_configure in Similar By Terms 6

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

Perform the "configure" op for hook_block().

Parameters

$delta: String specifying which block to proocess.

Return value

Settings form array.

1 call to similarterms_block_configure()
similarterms_block in ./similarterms.module
Implementation of hook_block().

File

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

Code

function similarterms_block_configure($delta = 0) {
  $form['count'] = array(
    '#type' => 'textfield',
    '#title' => t('Item count'),
    '#default_value' => variable_get('simterms_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_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('simterms_sametype_' . $delta, FALSE),
    '#options' => $types,
    '#description' => t('Limit to pages of this or these content type(s)'),
    '#multiple' => TRUE,
  );
  if ($delta > 0) {
    $terms = array();
    $tree = taxonomy_get_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('simterms_ignoreterms_' . $delta, array()),
      '#options' => $terms,
      '#description' => t('Ignore selected terms here from being used to search for similar entries'),
      '#multiple' => TRUE,
    );
  }
  return $form;
}