diff --git a/core/includes/form.inc b/core/includes/form.inc index 362d0d5..ba10183 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -3892,9 +3892,15 @@ function theme_button($variables) { $element['#attributes']['type'] = 'submit'; element_set_attributes($element, array('id', 'name', 'value')); - $element['#attributes']['class'][] = 'form-' . $element['#button_type']; + $element['#attributes']['class'][] = 'button'; + if (!empty($element['#button_type'])) { + $element['#attributes']['class'][] = 'button-' . $element['#button_type']; + } + else { + $element['#attributes']['class'][] = 'form-submit'; + } if (!empty($element['#attributes']['disabled'])) { - $element['#attributes']['class'][] = 'form-button-disabled'; + $element['#attributes']['class'][] = 'button-disabled'; } return ''; diff --git a/core/modules/entity/lib/Drupal/entity/EntityFormController.php b/core/modules/entity/lib/Drupal/entity/EntityFormController.php index 4f1263c..e40f041 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityFormController.php +++ b/core/modules/entity/lib/Drupal/entity/EntityFormController.php @@ -96,6 +96,12 @@ class EntityFormController implements EntityFormControllerInterface { $delete = $element['delete']; unset($element['delete']); $element['delete'] = $delete; + $element['delete']['#button_type'] = 'delete'; + } + + if (isset($element['submit'])) { + // Give the primary submit button a #button_type of primary. + $element['submit']['#button_type'] = 'primary'; } $count = 0; diff --git a/core/modules/user/lib/Drupal/user/ProfileFormController.php b/core/modules/user/lib/Drupal/user/ProfileFormController.php index d32cf4a..de71840 100644 --- a/core/modules/user/lib/Drupal/user/ProfileFormController.php +++ b/core/modules/user/lib/Drupal/user/ProfileFormController.php @@ -21,16 +21,10 @@ class ProfileFormController extends AccountFormController { $element = parent::actions($form, $form_state); $account = $this->getEntity($form_state); - // @todo Actually the cancel action can be assimilated to the delete one: we - // should alter it instead of providing a new one. - unset($element['delete']); - - $element['cancel'] = array( - '#type' => 'submit', - '#value' => t('Cancel account'), - '#submit' => array('user_edit_cancel_submit'), - '#access' => $account->uid > 1 && (($account->uid == $GLOBALS['user']->uid && user_access('cancel account')) || user_access('administer users')), - ); + $element['delete']['#type'] = 'submit'; + $element['delete']['#value'] = t('Cancel account'); + $element['delete']['#submit'] = array('user_edit_cancel_submit'); + $element['delete']['#access'] = $account->uid > 1 && (($account->uid == $GLOBALS['user']->uid && user_access('cancel account')) || user_access('administer users')); return $element; } diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css index f1e7321..d070637 100644 --- a/core/themes/seven/style.css +++ b/core/themes/seven/style.css @@ -714,6 +714,175 @@ div.filter-options select { padding: 0; } +/* Form actions */ +.form-actions { + margin-top: 1em; +} +.form-actions > * { + margin-right: 1em; /* LTR; @todo RTL */ +} +.form-action-group { + display: inline-block; +} +.button-delete { + float: right; /* LTR; @todo RTL */ + margin-right: 0; /* LTR; @todo RTL */ + width: auto; +} +@media screen and (max-width: 600px) { + .form-actions * { + margin-top: 0.75em; + margin-right: 0; /* LTR; @todo RTL */ + width: 100%; + } +} + +/** + * Buttons + * + * 1. Font metrics matter for vertical centering of button text. Choose a single + * consistent typeface. + * 2. Image file gradient fallback + */ +.button { + background: #f9f9f9 url(images/buttons.png) repeat-x left top; /* 2 */ + background: #f9f9f9 -moz-linear-gradient(top, transparent, rgba(0, 0, 0, .12)); + background: #f9f9f9 -ms-linear-gradient(top, transparent, rgba(0, 0, 0, .12)); + background: #f9f9f9 -o-linear-gradient(top, transparent, rgba(0, 0, 0, .12)); + background: #f9f9f9 -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, .12)); + background: #f9f9f9 linear-gradient(top, transparent, rgba(0, 0, 0, .12)); + border: 1px solid #999; + -moz-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .15), inset 0 1px 0 rgba(255, 255, 255, .4); + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .15), inset 0 1px 0 rgba(255, 255, 255, .4); + box-shadow: 0 1px 2px rgba(0, 0, 0, .15), inset 0 1px 0 rgba(255, 255, 255, .4); + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #222; + cursor: pointer; + display: inline-block; + font-family: Arial, sans-serif; /* 1 */ + line-height: 1em; + padding: 8px 2.5em; + text-align: center; + text-decoration: none; + text-shadow: 0 1px rgba(255, 255, 255, .85); +} +.button:focus, +.button:hover { + background: white -moz-linear-gradient(top, transparent, rgba(0, 0, 0, .09)); + background: white -ms-linear-gradient(top, transparent, rgba(0, 0, 0, .09)); + background: white -o-linear-gradient(top, transparent, rgba(0, 0, 0, .09)); + background: white -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, .09)); + background: white linear-gradient(top, transparent, rgba(0, 0, 0, .09)); +} +.button:active { + background: #f9f9f9 url(images/buttons.png) repeat-x left bottom; + background: #f9f9f9 -moz-linear-gradient(bottom, rgba(0, 0, 0, .05), rgba(0, 0, 0, .15)); + background: #f9f9f9 -ms-linear-gradient(bottom, rgba(0, 0, 0, .05), rgba(0, 0, 0, .15)); + background: #f9f9f9 -o-linear-gradient(bottom, rgba(0, 0, 0, .05), rgba(0, 0, 0, .15)); + background: #f9f9f9 -webkit-linear-gradient(bottom, rgba(0, 0, 0, .05), rgba(0, 0, 0, .15)); + background: #f9f9f9 linear-gradient(bottom, rgba(0, 0, 0, .05), rgba(0, 0, 0, .15)); + border-color: #999; + -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25); + -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25); + box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25); +} +.form-file .button, +.form-item-operation .button { + margin-left: .5em; +} +td .button { + height: auto; + padding-bottom: .4em; + padding-top: .4em; +} +/** + * Reversed-color buttons (white text on dark) + * + * 1. prevent over-bold letterforms in webkit + */ +.button-primary, +.button-delete { + color: white; + font-weight: bolder; + -webkit-font-smoothing: antialiased; /* 1 */ + text-shadow: 0 1px 1px rgba(0, 0, 0, .35); +} +/* Primary button */ +.button-primary { + background-color: #4f9fea; + background-image: -moz-linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + background-image: -ms-linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + background-image: -o-linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + background-image: -webkit-linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + background-image: linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + border-color: #3974ae; +} +.button-primary:focus, +.button-primary:hover { + background-color: #55adff; + background-image: -moz-linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, .4)); + background-image: -ms-linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, .4)); + background-image: -o-linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, .4)); + background-image: -webkit-linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, .4)); + background-image: linear-gradient(top, rgba(68, 129, 220, 0), rgba(68, 129, 220, .4)); + +} +.button-primary:active { + background-color: #4f9fea; + background-image: -moz-linear-gradient(bottom, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + background-image: -ms-linear-gradient(bottom, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + background-image: -o-linear-gradient(bottom, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + background-image: -webkit-linear-gradient(bottom, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + background-image: linear-gradient(bottom, rgba(68, 129, 220, 0), rgba(68, 129, 220, 1)); + border-color: #3974ae; +} +/* Delete button */ +.button-delete { + background-color: #ed522f; + background-image: -moz-linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + background-image: -ms-linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + background-image: -o-linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + background-image: -webkit-linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + background-image: linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + border-color: #91311c; +} +.button-delete:focus, +.button-delete:hover { + background-color: #ff6541; + background-image: -moz-linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, .4)); + background-image: -ms-linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, .4)); + background-image: -o-linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, .4)); + background-image: -webkit-linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, .4)); + background-image: linear-gradient(top, rgba(200, 61, 29, 0), rgba(200, 61, 29, .4)); +} +.button-delete:active { + background-color: #ed522f; + background-image: -moz-linear-gradient(bottom, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + background-image: -ms-linear-gradient(bottom, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + background-image: -o-linear-gradient(bottom, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + background-image: -webkit-linear-gradient(bottom, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + background-image: linear-gradient(bottom, rgba(200, 61, 29, 0), rgba(200, 61, 29, 1)); + border-color: #91311c; +} +/* Disabled buttons; selectors are overqualified to override other states. */ +.button.button[disabled], +.button.button-disabled, +input[type].form-button-disabled { + background: #eee; + border-color: #aaa; + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); + color: #777; + cursor: not-allowed; + opacity: .65; + text-shadow: none; +} + /** * System. */