You are here

function swftools_profiles_profile_form in SWF Tools 6.3

1 string reference to 'swftools_profiles_profile_form'
swftools_profiles_menu in profiles/swftools_profiles.module
Implementation of hook_menu().

File

profiles/swftools_profiles.admin.inc, line 65
Configuration settings for SWF Tools profiles.

Code

function swftools_profiles_profile_form($form_state, $profile = array(), $clone = FALSE) {

  // See if we are cloning a profile
  if ($clone) {
    $profile['clone'] = $profile['profile'];
    $profile['name'] = $profile['name'] . '_1';
    $profile['profile'] = $profile['profile'] . '_1';
  }

  // Initialise array to hold the form
  $form = array();

  // If an empty array was passed establish keys to suppress notice errors
  $profile += array(
    'name' => '',
    'profile' => '',
    'description' => '',
    'multiple' => 0x2,
    'download_link' => 0,
    'clone' => '',
  );
  $form['name'] = array(
    '#title' => t('Display name'),
    '#type' => 'textfield',
    '#default_value' => $profile['name'],
    '#description' => t('The human-readable name of this profile. This text will be displayed on the profiles listing page and in the CCK formatter list boxes. It is recommended that this name begin with a capital letter and contain only letters, numbers, and <strong>spaces</strong>. This name must be unique.'),
    '#required' => TRUE,
  );
  $form['old_name'] = array(
    '#type' => 'value',
    '#value' => $profile['name'],
  );
  $form['profile'] = array(
    '#title' => t('Profile name'),
    '#type' => 'textfield',
    '#default_value' => $profile['profile'],
    '#maxlength' => 32,
    '#required' => TRUE,
    '#description' => t('The machine-readable name of this profile. This name will be used by SWF Tools as the input filter <em>profile</em> property. This name must contain only lowercase letters, numbers, and underscores. This name must be unique.'),
  );
  $form['old_profile'] = array(
    '#type' => 'value',
    '#value' => $profile['profile'],
  );
  $form['description'] = array(
    '#title' => t('Description'),
    '#type' => 'textarea',
    '#default_value' => $profile['description'],
    '#description' => t('A brief description of this profile. This text will be displayed on the profiles listing page.'),
  );
  $form['clone'] = array(
    '#type' => 'value',
    '#value' => $profile['clone'],
  );
  if (module_exists('content')) {
    $form['multiple'] = array(
      '#type' => 'radios',
      '#title' => t('CCK output'),
      '#default_value' => $profile['multiple'],
      '#options' => array(
        CONTENT_HANDLE_MODULE => t('Playlist'),
        CONTENT_HANDLE_CORE => t('Separate players'),
      ),
      '#description' => t('Specifies whether content that has multiple elements will be rendered as a series of separate players, or assembled in to a playlist.'),
    );
    $form['download_link'] = array(
      '#type' => 'radios',
      '#title' => t('Download link'),
      '#default_value' => $profile['download_link'],
      '#options' => array(
        0 => t('Disabled'),
        1 => t('Enabled'),
      ),
      '#description' => t('If this profile is assigned to a CCK FileField or Linkfield then a link to the file can be included to allow users to download it. This setting is only effective when rendering content in to separate players.'),
    );
  }
  else {
    $form['multiple'] = array(
      '#type' => 'value',
      '#value' => $profile['multiple'],
    );
    $form['download_link'] = array(
      '#type' => 'value',
      '#value' => $profile['download_link'],
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save profile'),
    '#weight' => 9,
  );
  if ($profile['profile']) {
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete profile'),
      '#weight' => 45,
    );
  }

  // Return the form
  return $form;
}