You are here

function getdirections_returnlink_settings in Get Directions 7.3

Configure returnlinks

1 call to getdirections_returnlink_settings()
getdirections_settings_form in ./getdirections.admin.inc
Function to display the getdirections admin settings form

File

./getdirections.module, line 2476
Fetches google map directions.

Code

function getdirections_returnlink_settings($defaults) {
  $form = array();
  $entity_types = getdirections_get_enabled_entity_types();
  if (in_array('node', $entity_types)) {
    $form['node_enable'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable Page Return Link'),
      '#default_value' => $defaults['node_enable'],
      '#return_value' => 1,
    );
    $form['node_link'] = array(
      '#type' => 'textfield',
      '#title' => t('Text of page return link'),
      '#description' => t('Use %n to insert the page title'),
      '#default_value' => $defaults['node_link'],
      '#size' => 30,
      // need this to get validation to work
      '#parents' => array(
        'getdirections_returnlink',
        'node_link',
      ),
      '#prefix' => '<div id="wrap-node-link">',
      '#suffix' => '</div>',
    );
  }

  #  else {

  #    $form['node_enable'] = array('#type' => 'value', '#value' => 0);

  #    $form['node_link'] = array('#type' => 'value', '#value' => $defaults['node_link']);

  #  }
  if (in_array('user', $entity_types)) {
    $form['user_enable'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable User Return Link'),
      '#default_value' => $defaults['user_enable'],
      '#return_value' => 1,
    );
    $form['user_link'] = array(
      '#type' => 'textfield',
      '#title' => t('Text of user return link'),
      '#description' => t('Use %n to insert the user name'),
      '#default_value' => $defaults['user_link'],
      '#size' => 30,
      // need this to get validation to work
      '#parents' => array(
        'getdirections_returnlink',
        'user_link',
      ),
      '#prefix' => '<div id="wrap-user-link">',
      '#suffix' => '</div>',
    );
  }

  #  else {

  #    $form['user_enable'] = array('#type' => 'value', '#value' => 0);

  #    $form['user_link'] = array('#type' => 'value', '#value' => $defaults['user_link']);

  #  }
  if (in_array('taxonomy_term', $entity_types)) {
    $form['taxonomy_term_enable'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable Term Return Link'),
      '#default_value' => $defaults['taxonomy_term_enable'],
      '#return_value' => 1,
    );
    $form['taxonomy_term_link'] = array(
      '#type' => 'textfield',
      '#title' => t('Text of Term return link'),
      '#description' => t('Use %n to insert the term name'),
      '#default_value' => $defaults['taxonomy_term_link'],
      '#size' => 30,
      // need this to get validation to work
      '#parents' => array(
        'getdirections_returnlink',
        'taxonomy_term_link',
      ),
      '#prefix' => '<div id="wrap-term-link">',
      '#suffix' => '</div>',
    );
  }

  #  else {

  #    $form['taxonomy_term_enable'] = array('#type' => 'value', '#value' => 0);

  #    $form['taxonomy_term_link'] = array('#type' => 'value', '#value' => $defaults['taxonomy_term_link']);

  #  }
  if (in_array('comment', $entity_types)) {
    $form['comment_enable'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable Comment Return Link'),
      '#default_value' => $defaults['comment_enable'],
      '#return_value' => 1,
    );
    $form['comment_link'] = array(
      '#type' => 'textfield',
      '#title' => t('Text of Comment return link'),
      '#description' => t('Use %n to insert the comment subject'),
      '#default_value' => $defaults['comment_link'],
      '#size' => 30,
      // need this to get validation to work
      '#parents' => array(
        'getdirections_returnlink',
        'comment_link',
      ),
      '#prefix' => '<div id="wrap-comment-link">',
      '#suffix' => '</div>',
    );
  }

  #  else {

  #    $form['comment_enable'] = array('#type' => 'value', '#value' => 0);

  #    $form['comment_link'] = array('#type' => 'value', '#value' => $defaults['comment_link']);

  #  }
  return $form;
}