You are here

function slickgrid_form_user_profile_form_alter in Slickgrid 7.2

Implement hook_form_FORM_ID_alter().

The "Edit" user form. This needs to be able to handle both login and loginless changes.

File

./slickgrid.module, line 702

Code

function slickgrid_form_user_profile_form_alter(&$form, &$form_state) {
  if ($form['#user']->uid && !arg(3)) {
    $disabled = db_select('slickgrid', 's')
      ->fields('s')
      ->condition('uid', $form['#user']->uid)
      ->countQuery()
      ->execute()
      ->fetchCol();
    $form['slickgrid'] = array(
      '#type' => 'fieldset',
      '#title' => t('Slickgrid'),
      '#collapsed' => TRUE,
      '#collapsible' => TRUE,
    );
    if ($disabled[0]) {
      $form['slickgrid']['scratchpads_messages_reset_tips'] = array(
        '#type' => 'submit',
        '#value' => t('Reset Slickgrid settings'),
        '#submit' => array(
          'slickgrid_reset_user',
        ),
        '#limit_validation_errors' => array(),
      );
    }
    else {
      $form['slickgrid']['scratchpads_messages_reset_tips'] = array(
        '#markup' => '<p>' . t('You do not currently have any custom settings.') . '</p>',
      );
    }
  }
}