You are here

function insert_admin in Insert 7

Creates the global module configuration form.

Return value

array

1 string reference to 'insert_admin'
insert_menu in ./insert.module
Implements hook_menu().

File

./insert.module, line 67
Allows insertion of files, images, and other media directly into the body field by using an "Insert" button next to the uploaded file.

Code

function insert_admin() {
  $form = array();
  $form['insert'] = array(
    '#type' => 'container',
  );
  $form['insert']['file_extensions'] = array(
    '#type' => 'fieldset',
    '#title' => t('File type detection'),
    '#description' => t('In order for Insert to be able to handle particular file types (i.e. detecting image files when using the <em>Automatic</em> Insert option on generic file fields, detecting if files may be embedded as audio or video), the module needs be aware of which file extensions shall map to which file type. Be sure to enable these file extensions for upload in the file field settings as well.'),
  );
  foreach ([
    'insert_file_extensions_image' => t('Image file extensions'),
    'insert_file_extensions_audio' => t('Audio file extensions'),
    'insert_file_extensions_video' => t('Video file extensions'),
  ] as $key => $title) {
    $form['insert']['file_extensions'][$key] = array(
      '#type' => 'textfield',
      '#title' => $title,
      '#default_value' => join(', ', variable_get($key, unserialize(INSERT_DEFAULT_CONFIG)[$key])),
      '#description' => t('Separate extensions with a space or comma and do not include the leading dot.'),
      '#element_validate' => [
        '_insert_string_to_array',
      ],
    );
  }
  return system_settings_form($form);
}