function file_entity_file_type_form

cis7 file_entity.admin.inc file_entity_file_type_form($form, &$form_state, $type = NULL)
cle7 file_entity.admin.inc file_entity_file_type_form($form, &$form_state, $type = NULL)
elmsmedia7 file_entity.admin.inc file_entity_file_type_form($form, &$form_state, $type = NULL)
icor7 file_entity.admin.inc file_entity_file_type_form($form, &$form_state, $type = NULL)
meedjum_blog7 file_entity.admin.inc file_entity_file_type_form($form, &$form_state, $type = NULL)
mooc7 file_entity.admin.inc file_entity_file_type_form($form, &$form_state, $type = NULL)

Form constructor for the file type settings form.

Parameters

object $type: The file type.

See also

file_entity_file_type_form_validate()

file_entity_file_type_form_submit()

1 string reference to 'file_entity_file_type_form'
file_entity_menu in sites/all/modules/ulmus/file_entity/file_entity.module
Implements hook_menu().

File

sites/all/modules/ulmus/file_entity/file_entity.admin.inc, line 801
File administration and module settings UI.

Code

function file_entity_file_type_form($form, &$form_state, $type = NULL) {
  if (!isset($type->type)) {
    // This is a new type.
    $type = (object) array(
      'type' => '',
      'label' => '',
      'description' => '',
      'mimetypes' => array(),
    );
  }
  $form['#file_type'] = $type;

  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#description' => t('This is the human readable name of the file type.'),
    '#required' => TRUE,
    '#default_value' => $type->label,
  );

  $form['type'] = array(
    '#type' => 'machine_name',
    '#default_value' => $type->type,
    '#maxlength' => 255,
    '#disabled' => (bool) $type->type,
    '#machine_name' => array(
      'exists' => 'file_type_load',
      'source' => array('label'),
    ),
    '#description' => t('A unique machine-readable name for this file type. It must only contain lowercase letters, numbers, and underscores.'),
  );

  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#description' => t('This is the description of the file type.'),
    '#default_value' => $type->description,
  );

  $form['mimetypes'] = array(
    '#type' => 'textarea',
    '#title' => t('Mimetypes'),
    '#description' => t('Enter one mimetype per line.'),
    '#default_value' => implode("\n", $type->mimetypes),
  );

  include_once DRUPAL_ROOT . '/includes/file.mimetypes.inc';
  $mimetypes = file_mimetype_mapping();

  $form['mimetype_mapping'] = array(
    '#type' => 'fieldset',
    '#title' => t('Mimetype List'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['mimetype_mapping']['mapping'] = array(
    '#theme' => 'item_list',
    '#items' => $mimetypes['mimetypes'],
  );

  $form['actions'] = array('#type' => 'actions');

  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  if (!empty($type->type)) {
    $form['actions']['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
  }

  return $form;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.