You are here

function finder_node_form_finder_admin_element_edit_alter in Finder 7

Same name and namespace in other branches
  1. 6 modules/finder_node/finder_node.module \finder_node_form_finder_admin_element_edit_alter()

Implements hook_form_alter().

See also

hook_form_alter()

File

modules/finder_node/finder_node.module, line 46
The finder node module.

Code

function finder_node_form_finder_admin_element_edit_alter(&$form, $form_state) {
  $finder =& $form_state['storage']['finder'];
  if ($finder->base == 'node') {
    $element =& $form_state['storage']['finder_element_defaults'];
    $types = finder_node_get_types();
    if ($types) {
      $form['settings']['choices']['node_types'] = array(
        '#type' => 'select',
        '#title' => t('Restrict nodes that can be found to only these content types'),
        '#default_value' => $element->settings['choices']['node_types'],
        '#options' => $types,
        '#description' => t('If no content type is selected, nodes of all types will be displayed.'),
        '#multiple' => TRUE,
        '#size' => min(6, count($types) + 1),
        '#weight' => 10,
      );
    }
    else {
      $form['settings']['choices']['no_types'] = array(
        '#value' => t("<em>There are currently no content types to choose from.</em>"),
        '#weight' => 10,
      );
    }
    $form['settings']['choices']['published'] = array(
      '#type' => 'checkbox',
      '#title' => t('Published'),
      '#default_value' => $element->settings['choices']['published'],
      '#weight' => 90,
      '#description' => t('Only show nodes that are published.'),
    );
    $form['settings']['choices']['per_result'] = array(
      '#type' => 'checkbox',
      '#title' => t('Choices per result'),
      '#default_value' => $element->settings['choices']['per_result'],
      '#weight' => 110,
      '#description' => t('Forces finder to internally process a choice for each potential result node.'),
    );
  }
}