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

Implements hook_form_alter().


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


function admin_bar_form_alter(&$form, &$form_state, $form_id) {
  $global_flush_ids = array(
    // Update links for clean/non-clean URLs.
    // Incorporate changed user permissions.
    // Removing a role potentially means less permissions.
    // User name and roles may be changed on the user account 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';