You are here

function gallery_assist_form_alter in Gallery Assist 6

Same name and namespace in other branches
  1. 7 gallery_assist.module \gallery_assist_form_alter()

Implementation of hook_form_alter().

File

./gallery_assist.module, line 945
Drupal content type with gallery functionality.

Code

function gallery_assist_form_alter(&$form, &$form_state, $form_id) {
  global $user;
  $argumente = arg();

  // Toggle to show or hide the author information from the image preview.
  if ($form_id == 'system_theme_settings' && $argumente[count($argumente) - 1] == 'settings') {
    $theme_settings = theme_get_settings();
    $types = gallery_assist_get_assignments('all');
    foreach ($types as $type => $name) {
      if ($type == 'gallery_assist') {
        $title = t('Gallery Assist Item preview');
      }
      else {
        $title = t('@name GA Item preview', array(
          '@name' => $name,
        ));
      }
      $form['node_info']["toggle_node_info_{$type}_item"] = array(
        '#type' => 'checkbox',
        '#title' => $title,
        '#default_value' => $theme_settings["toggle_node_info_{$type}_item"],
      );
      asort($form['node_info']);
    }
  }

  // Gallery Assist extra user information.
  if (arg(0) === 'user' && arg(2) === 'edit' && $form_id == 'user_profile_form') {
    if (gallery_assist_check_access($node, 'edit')) {
      $form['gallery_assist_user_extras'] = array(
        '#type' => 'fieldset',
        '#title' => t('Gallery Assist user settings'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#access' => function_exists('gallery_assist_flickr_form_alter') || function_exists('gallery_assist_picasa_form_alter') ? TRUE : FALSE,
      );
    }
  }
  if (isset($form['#node']) && variable_get('gallery_assist_' . $form['#node']->type, 0) == 1 && $form['#node']->type . '_node_form' == $form_id && gallery_assist_check_access($form['#node'], 'edit')) {
    $form += _get_ga_form($form);
    if (function_exists('pathauto_menu')) {
      $form['path']['ga_rebuild_items_alias'] = array(
        '#type' => 'checkbox',
        '#title' => 'Automatic image aliases',
        '#default_value' => $form['#node']->ga_rebuild_items_alias,
      );
    }
  }
  unset($this);
}