You are here

function _javascript_libraries_build_default_row in JavaScript Libraries Manager 7

Build a table row for the default libraries table.

1 call to _javascript_libraries_build_default_row()
javascript_libraries_default_form in ./javascript_libraries.admin.inc
Form builder function for page callback.

File

./javascript_libraries.admin.inc, line 163
Administrative management forms for JavaScript libraries.

Code

function _javascript_libraries_build_default_row($key, $library = array()) {

  // Add in the defaults.
  $library += array(
    'disabled' => FALSE,
    'checked' => FALSE,
  );

  // Set the table row properties.
  if (!empty($library['website'])) {
    $title = l($library['title'], $library['website'], array(
      'attributes' => array(
        'title' => t('Documentation for @title', array(
          '@title' => $library['title'],
        )),
        'target' => '_new',
      ),
    ));
  }
  else {
    $title = $library['title'];
  }
  $form['name'] = array(
    '#markup' => filter_xss_admin($title),
  );
  $form['version'] = array(
    '#markup' => check_plain($library['version']),
  );

  // Build the checkbox.
  $form['enable']['#tree'] = TRUE;
  $form['enable'][$key] = array(
    '#type' => 'checkbox',
    '#default_value' => $library['checked'],
    '#return_value' => array(
      'library' => $library['name'],
      'module' => $library['module'],
    ),
  );
  if ($library['disabled']) {
    $form['enable'][$key]['#disabled'] = TRUE;
  }
  return $form;
}