1 admin_bar.module admin_bar_form_alter(&$form, &$form_state, $form_id)

Implements hook_form_alter().

File

core/modules/admin_bar/admin_bar.module, line 698
Render an administrative bar as a dropdown menu at the top of the window.

Code

function admin_bar_form_alter(&$form, &$form_state, $form_id) {
  $global_flush_ids = array(
    'admin_bar_theme_settings',
    // Update links for clean/non-clean URLs.
    'system_clean_url_settings',
    // Incorporate changed user permissions.
    'user_admin_permissions',
    // Removing a role potentially means less permissions.
    'user_admin_role_delete_confirm',
    // User name and roles may be changed on the user account form.
    'user_profile_form',
  );
  if (in_array($form_id, $global_flush_ids)) {
    $form['#submit'][] = 'admin_bar_form_alter_flush_cache_submit';

    // Optionally limit the cache flush to a certain user ID.
    $form_state['admin_bar_uid'] = NULL;
    if ($form_id == 'user_profile_form') {
      $form_state['admin_bar_uid'] = $form_state['user']->uid;
    }
  }

  // UX: Add a confirmation to the permissions form to ask the user whether to
  // auto-enable the 'access administration bar' permission along with
  // 'access administration pages'.
  if ($form_id == 'user_admin_permissions') {
    $form['#attached']['js'][] = backdrop_get_path('module', 'admin_bar') . '/js/admin_bar.admin.js';
  }
}