You are here

function galleria_form_settings in Galleria 7

Form builder; Form for advanced module settings.

1 string reference to 'galleria_form_settings'
galleria_menu in ./galleria.module
Implements hook_menu().

File

includes/galleria.admin.inc, line 897
Administrative page callbacks for the galleria module.

Code

function galleria_form_settings() {
  $form = array();
  $form['library'] = array(
    '#type' => 'fieldset',
    '#title' => 'Library',
  );
  $file = libraries_get_path('galleria');
  if (!is_dir($file)) {
    drupal_set_message(t('Library directory not found: <code>@file</code>', array(
      '@file' => $file,
    )), 'error', FALSE);
  }
  $form['library']['lib_path'] = array(
    '#type' => 'item',
    '#title' => t('Library path'),
    '#markup' => t('<code>@file</code>', array(
      '@file' => $file,
    )),
  );
  $file = galleria_get_library_file();
  $form['library']['lib_file'] = array(
    '#type' => 'item',
    '#title' => t('Library file'),
    '#markup' => $file ? t('<code>@file</code>', array(
      '@file' => $file,
    )) : t('Unknown'),
    '#description' => t('This filename is cached until the file is deleted.'),
  );
  $form['library']['themes_title'] = array(
    '#type' => 'item',
    '#title' => t('Themes'),
    '#description' => t('The following themes are currently known to the module. Clear the cache to search for new ones.'),
  );
  $form['library']['themes'] = array(
    '#theme' => 'galleria_form_table',
    '#header' => array(
      t('Name'),
      t('JavaScript file'),
    ),
    '#empty' => t('No themes found!'),
  );
  foreach (galleria_get_themes() as $theme => $file) {
    $form['library']['themes'][] = array(
      array(
        '#markup' => check_plain($theme),
      ),
      array(
        '#markup' => t('<code>@file</code>', array(
          '@file' => $file,
        )),
      ),
    );
  }
  $form['library']['plugins_title'] = array(
    '#type' => 'item',
    '#title' => t('Plugins'),
    '#description' => t('The following plugins are currently known to the module. Clear the cache to search for new ones.'),
  );
  $form['library']['plugins'] = array(
    '#theme' => 'galleria_form_table',
    '#header' => array(
      t('Name'),
      t('JavaScript file'),
    ),
    '#empty' => t('No plugins found!'),
  );
  foreach (galleria_get_plugins() as $plugin => $file) {
    $form['library']['plugins'][] = array(
      array(
        '#markup' => check_plain($plugin),
      ),
      array(
        '#markup' => t('<code>@file</code>', array(
          '@file' => $file,
        )),
      ),
    );
  }
  $form['library']['button_clearcache'] = array(
    '#type' => 'submit',
    '#name' => 'button_clearcache',
    '#value' => t('Clear cache'),
    '#submit' => array(
      'galleria_form_settings_submit_clearcache',
    ),
  );
  return $form;
}