You are here

function dynamic_banner_default_admin_form in Dynamic Banner 6

1 string reference to 'dynamic_banner_default_admin_form'
dynamic_banner_menu in ./dynamic_banner.module
Implements hook_menu().

File

includes/callbacks.inc, line 70
Dynamic Banner Admin Pages and various other functions to make them work Most of the code in this file was derived from path module

Code

function dynamic_banner_default_admin_form(&$form_state) {
  $default_banner_json = variable_get('dynamic_banner_default_banner', '');
  $form['imgurl'] = array(
    '#type' => 'textfield',
    '#title' => t('Image Url'),
    '#maxlength' => 128,
    '#size' => 45,
    '#description' => t('Specify the path to the image.
      Starting from the root site directory(comma seperated for randoms).'),
    '#field_prefix' => url(NULL, array(
      'absolute' => TRUE,
    )) . (variable_get('clean_url', 0) ? '' : '?q='),
    '#required' => TRUE,
  );
  $form['text'] = array(
    '#type' => 'textfield',
    '#title' => t('Banner Text'),
    '#maxlength' => 128,
    '#size' => 45,
    '#description' => t('Specify the text to associate with this banner
      (comma seperated for randoms) (also must match amount of elements
      from images) --optional--'),
    '#required' => FALSE,
  );
  $form['link'] = array(
    '#type' => 'textfield',
    '#title' => t('Banner Link'),
    '#maxlength' => 128,
    '#size' => 45,
    '#description' => t('Specify the link you want your banner
      to point to --optional--'),
    '#field_prefix' => url(NULL, array(
      'absolute' => TRUE,
    )) . (variable_get('clean_url', 0) ? '' : '?q='),
    '#required' => FALSE,
  );

  // if we have a banner then allow edits to that banner
  if ($default_banner_json !== '') {
    $default_banner = json_decode($default_banner_json);
    $form['imgurl']['#default_value'] = $default_banner->imgurl;
    $form['text']['#default_value'] = $default_banner->text;
    $form['link']['#default_value'] = $default_banner->link;
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update Banner'),
  );
  return $form;
}