You are here

function space_setting_logo::form in Spaces 6.2

Overrides space_setting::form

File

spaces_design/spaces_design.spaces.inc, line 13

Class

space_setting_logo
Provides a logo setting for each space.

Code

function form($space, $value = array()) {
  $form = array();
  $form['#title'] = t('Logo');
  $form['#description'] = t('Upload a logo image for this space. The image will be resized to better fit the design of this site.');
  if (!empty($value['fid'])) {
    $file = db_fetch_object(db_query('SELECT * FROM {files} f WHERE f.fid = %d', $value['fid']));
    if (!empty($file)) {
      $form['file'] = array(
        '#type' => 'value',
        '#value' => $file,
      );
      $form['display'] = array(
        '#type' => 'markup',
        '#value' => theme('imagecache', 'spaces-logo', $file->filepath),
      );
      $form['delete'] = array(
        '#type' => 'checkbox',
        '#title' => t('Delete current logo'),
      );
    }
  }
  $form['upload'] = array(
    '#type' => 'file',
    '#title' => t('Upload logo'),
    '#size' => 30,
    '#description' => t('Upload a new logo for this space.'),
    '#element_validate' => array(
      'spaces_design_upload_validate',
    ),
  );
  $form['fid'] = array(
    '#type' => 'value',
    '#value' => !empty($value['fid']) ? $value['fid'] : 0,
  );
  return $form;
}