You are here

function radioactivity_arbitrary_source_admin_source in Radioactivity 5

1 string reference to 'radioactivity_arbitrary_source_admin_source'
radioactivity_arbitrary_source_menu in plugins/radioactivity_arbitrary_source.module

File

plugins/radioactivity_arbitrary_source.module, line 117

Code

function radioactivity_arbitrary_source_admin_source($target = NULL, $source = NULL) {
  $sources = _radioactivity_get_arbitrary_sources();
  $form = array();
  $form['#action'] = url('admin/settings/radioactivity/arbitrary_source');
  $form['target_hidden'] = array(
    '#type' => 'hidden',
    '#default_value' => $target,
  );
  $form['source_hidden'] = array(
    '#type' => 'hidden',
    '#default_value' => $source,
  );
  $form['target'] = array(
    '#type' => 'item',
    '#title' => t('Target name'),
    '#value' => check_plain($target),
  );
  $form['identifier'] = array(
    '#type' => 'textfield',
    '#title' => t('Source identifier'),
    '#default_value' => $source,
    '#required' => TRUE,
    '#description' => t('This is the source identifier. You may use lower case alphabets a-z, numbers, and underscore.'),
  );
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Source label'),
    '#default_value' => $sources[$target][$source]['title_placeholder'],
    '#description' => t('This is the human readable name of the source.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
  );
  if ($source) {
    $form['submit']['#value'] = t('Edit');
  }
  else {
    $form['submit']['#value'] = t('Create');
  }
  $form['cancel']['#value'] = l(t('Cancel'), 'admin/settings/radioactivity/arbitrary_sources');
  return $form;
}