You are here

function _jqp_form_elements in jQuery Plugin Handler (JQP) 6.2

Helper function for dynamically creating the form elements required by a single file.

1 call to _jqp_form_elements()
js_library_edit in ./jqp.admin.inc
Builds the form which is used to edit a single version of a library

File

./jqp.admin.inc, line 172
This file includes all functionality for the libraries configuration pages

Code

function _jqp_form_elements(&$form, $index, $values = array()) {
  $form["file-{$index}-name"] = array(
    '#title' => t('Name'),
    '#type' => 'textfield',
    '#default_value' => $values['name'],
    '#size' => 10,
    '#required' => !($index < 0),
    '#disabled' => $index < 0,
  );
  $form["file-{$index}-path"] = array(
    '#title' => t('Path'),
    '#type' => 'textfield',
    '#size' => FALSE,
    '#default_value' => $values['path'],
    '#autocomplete_path' => 'jqp_autocomplete',
    '#required' => !($index < 0),
    '#disabled' => $index < 0,
  );
  $form["file-{$index}-type"] = array(
    '#title' => t('Type'),
    '#type' => 'select',
    '#default_value' => $values['type'],
    '#options' => array(
      'scripts' => t('Javascript'),
      'stylesheets' => t('Stylesheet'),
    ),
    '#required' => !($index < 0),
    '#disabled' => $index < 0,
  );
  $form["file-{$index}-operations"] = array(
    '#value' => !empty($values['operations']) ? join($values['operations']) : '',
  );
  $form["file-{$index}-status"] = array(
    '#type' => 'value',
    '#value' => file_exists($values['path']),
  );
  $form["file-{$index}-version"] = array(
    '#type' => 'value',
    '#value' => $values['version'],
  );
  $form['files']['#value'][$index] = $values['name'];
}