Fixes some PAReview issues.
[project/rijkshuisstijl.git] / functions / form.php
1 <?php
2 /**
3 * @file
4 * Contains all functionality for theming forms.
5 */
6
7 /**
8 * Implements hook_form_alter().
9 */
10 function rijkshuisstijl_form_alter(&$form, &$form_state, $form_id) {
11 if ($form_id == 'search_block_form') {
12 // Change the text on the submit button.
13 $form['actions']['submit']['#value'] = t('search');
14 // Change class on the submit button.
15 // $form['actions']['submit']['#attributes']['class'][] = 'search';
16 }
17 }
18
19 /**
20 * Implements hook_form_FORM_ID_alter().
21 */
22 function rijkshuisstijl_form_user_login_alter(&$form, &$form_state, $form_id) {
23 $form['mandatory'] = array(
24 '#markup' => '<p class="mandatory">' . t('Required fields are marked with a !required', array('!required' => theme('form_required_marker'))) . '</p>',
25 '#weight' => -100,
26 );
27
28 $form['pass']['#description'] .= ' ' . l(t('Forgot password?'), 'user/password', array('attributes' => array('title' => t('Forgot password?'))));
29
30 $form['fieldset'] = array(
31 '#type' => 'fieldset',
32 '#title' => t('Login'),
33 'name' => $form['name'],
34 'pass' => $form['pass'],
35 'remember_me' => isset($form['remember_me']) ? $form['remember_me'] : array(),
36 );
37
38 unset($form['name']);
39 unset($form['pass']);
40 unset($form['remember_me']);
41 }
42
43 /**
44 * Implements hook_form_FORM_ID_alter().
45 */
46 function rijkshuisstijl_form_user_pass_alter(&$form, &$form_state, $form_id) {
47 $form['mandatory'] = array(
48 '#markup' => '<p class="mandatory">' . t('Required fields are marked with a !required', array(
49 '!required' => theme('form_required_marker'),
50 )) . '</p>',
51 '#weight' => -100,
52 );
53
54 $form['fieldset'] = array(
55 '#type' => 'fieldset',
56 '#title' => t('Forgot password'),
57 'name' => $form['name'],
58 'back' => array(
59 '#markup' => '<div class="form-item"><div class="description">' . t('Go back to !login', array(
60 '!login' => l(t('login'), 'user/login', array(
61 'attributes' => array(
62 'title' => t('Back to login'),
63 ),
64 )
65 ))) . '</div></div>',
66 ),
67 );
68
69 unset($form['name']);
70 }
71
72 /**
73 * Implements hook_form_FORM_ID_alter().
74 */
75 function rijkshuisstijl_form_user_register_form_alter(&$form, &$form_state, $form_id) {
76 $form['mandatory'] = array(
77 '#markup' => '<p class="mandatory">' . t('Required fields are marked with a !required', array(
78 '!required' => theme('form_required_marker'),
79 )) . '</p>',
80 '#weight' => -100,
81 );
82 }