From c8b67a201f3a9535ca23cb86801d5e04dba54e8f Tue, 9 Aug 2011 22:15:48 +0200 From: Bram Goffings Date: Tue, 9 Aug 2011 22:15:42 +0200 Subject: [PATCH] primary property diff --git a/includes/form.inc b/includes/form.inc index 40363d6..4c94207 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -3593,6 +3593,9 @@ if (!empty($element['#attributes']['disabled'])) { $element['#attributes']['class'][] = 'form-button-disabled'; } + if (!empty($element['#primary'])) { + $element['#attributes']['class'][] = 'form-button-primary'; + } return ''; } @@ -3621,6 +3624,9 @@ $element['#attributes']['class'][] = 'form-' . $element['#button_type']; if (!empty($element['#attributes']['disabled'])) { $element['#attributes']['class'][] = 'form-button-disabled'; + } + if (!empty($element['#primary'])) { + $element['#attributes']['class'][] = 'form-button-primary'; } return ''; @@ -3801,6 +3807,7 @@ * - form-item-#name: The internal form element #name (usually derived from the * $form structure and set via form_builder()). * - form-disabled: Only set if the form element is #disabled. + * - form-primary: Only set if this is the primary form element. * * In addition to the element itself, the DIV contains a label for the element * based on the optional #title_display property, and an optional #description. @@ -3864,6 +3871,10 @@ if (!empty($element['#attributes']['disabled'])) { $attributes['class'][] = 'form-disabled'; } + // Add a class for primary a primary form element. + if (!empty($element['#primary'])) { + $attributes['class'][] = 'form-primary'; + } $output = '' . "\n"; // If #title is not set, we don't display any label or required marker. diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index d92e8b7..111867a 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -270,6 +270,7 @@ '#access' => variable_get('node_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || (!form_get_errors() && isset($form_state['node_preview'])), '#value' => t('Save'), '#weight' => 5, + '#primary' => TRUE, '#submit' => array('node_form_submit'), ); $form['actions']['preview'] = array(