You are here

function prev_next_block_configure in Previous/Next API 7

Same name and namespace in other branches
  1. 7.2 prev_next.block.inc \prev_next_block_configure()

Implements hook_block_configure().

File

./prev_next.module, line 294

Code

function prev_next_block_configure($delta) {
  $description = 'Use the available tokens ' . (module_exists('token') ? '(see below)' : '') . ' to customize the link text.';
  $form['previous'] = array(
    '#type' => 'fieldset',
    '#title' => t('Previous Node'),
    '#collapsible' => TRUE,
  );
  $form['previous']['prev_next_display_prev' . $delta] = array(
    '#type' => 'checkbox',
    '#title' => t('Display'),
    '#default_value' => variable_get('prev_next_display_prev' . $delta, PREV_NEXT_DISPLAY_DEFAULT),
  );
  $form['previous']['prev_next_display_text_prev' . $delta] = array(
    '#type' => 'textfield',
    '#title' => t('Link text'),
    '#description' => $description,
    '#default_value' => variable_get('prev_next_display_text_prev' . $delta, PREV_NEXT_DISPLAY_TEXT_PREV_DEFAULT),
  );
  if (module_exists('token')) {
    $form['previous']['tokens'] = array(
      '#type' => 'fieldset',
      '#title' => t('Replacement patterns'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['previous']['tokens']['tokens'] = array(
      '#theme' => 'token_tree',
      '#token_types' => array(
        'node',
      ),
    );
  }
  $form['next'] = array(
    '#type' => 'fieldset',
    '#title' => t('Next Node'),
    '#collapsible' => TRUE,
  );
  $form['next']['prev_next_display_next' . $delta] = array(
    '#type' => 'checkbox',
    '#title' => t('Display'),
    '#default_value' => variable_get('prev_next_display_next' . $delta, PREV_NEXT_DISPLAY_DEFAULT),
  );
  $form['next']['prev_next_display_text_next' . $delta] = array(
    '#type' => 'textfield',
    '#title' => t('Link text'),
    '#description' => $description,
    '#default_value' => variable_get('prev_next_display_text_next' . $delta, PREV_NEXT_DISPLAY_TEXT_NEXT_DEFAULT),
  );
  if (module_exists('token')) {
    $form['next']['tokens'] = array(
      '#type' => 'fieldset',
      '#title' => t('Replacement patterns'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['next']['tokens']['tokens'] = array(
      '#theme' => 'token_tree',
      '#token_types' => array(
        'node',
      ),
    );
  }
  return $form;
}